Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, March 23, 2013

Scrolling Text Using Javascript


This is the scrolling text.

Code for the scrolling effect is written below:

<style type="text/css">
#scroll{
         position : absolute;
      white-space : nowrap;
              top : 0px;
             left : 200px;
       }
#oScroll{
    margin : 1px;
   padding : 0px;
         position : relative;
            width : 450px; /* width of the scroll box */
           height : 20px;
         overflow : hidden;
        }
      </style>
      <script type="text/javascript">
     function scroll(oid,iid){
          this.oCont=document.getElementById(oid)
          this.ele=document.getElementById(iid)
          this.width=this.ele.clientWidth;
          this.n=this.oCont.clientWidth;
          this.move=function(){
             this.ele.style.left=this.n+"px"
             this.n--
             if(this.n<(-this.width)){this.n=this.oCont.clientWidth}
                              }
                             }
     var vScroll
     function setup(){
         vScroll=new scroll("oScroll","scroll");
         setInterval("vScroll.move()",50) //controls the speed of scrolling, higher means slower
                     }
  onload=function(){setup()}
      </script>
<br />
<div id="oScroll">
<div id="scroll">
This is the <a href="http://questionsans.blogspot.com/2013/03/scrolling-text-using-javascript.html">scrolling text</a></div>
</div>

Friday, March 8, 2013

Codecademy Sample Solution: Echo It!


<!DOCTYPE html>
<html>
    <head>
        <link type='text/css' rel='stylesheet' href='style.css'/>
<title>PHP FTW!</title>
</head>
<body>
        <!-- Write your PHP code below!-->
        <p>
        <?php
            $myName = "Batman";
            echo "My name is ".$myName.". <br>";
            $myAge = 24;
            echo "I'm ".$myAge." years old."
        ?>  
        </p>  
</body>
</html>

Codecademy Sample Solution: Let The Machine Do The Math


<!DOCTYPE html>
<html>
    <head>
        <link type='text/css' rel='stylesheet' href='style.css'/>
<title>PHP FTW!</title>
</head>
<body>
        <!-- Write your PHP code below!-->
        <p>
        <?php
            $myName = "Batman";
            echo "My name is ".$myName.". <br>";
            $myAge = 24;
            echo "I'm ".$myAge." years old."
        ?>  
        </p>  
</body>
</html>

Codecademy Sample Solution: Creating a Variable


<!DOCTYPE html>
<html>
    <head>
        <link type='text/css' rel='stylesheet' href='style.css'/>
<title>PHP FTW!</title>
</head>
<body>
        <!-- Write your PHP code below!-->
        <p>
        <?php
            $myName = "Batman";
            echo $myName;
        ?>  
        </p>  
</body>
</html>

Thursday, March 7, 2013

Codecademy Sample Solution: Comments


<!DOCTYPE html>
<html>
<head>
<title>Oh No!</title>
</head>
<body>
        <p><?php
            echo "Oh, the humanity!";
            //whatever I like!
          ?></p>
    </body>
</html>

Codecademy Sample Solution: Semicolons


<!DOCTYPE html>
<html>
<head>
<title>Oh No!</title>
</head>
<body>
        <p><?php
            echo "Oh, the humanity!";
          ?></p>
    </body>
</html>

Codecademy Sample Solution: Variables


<!DOCTYPE html>
<html>
<head>
<title>Variable Magic</title>
</head>
<body>
        <!-- Add your PHP code between the <p></p> tags! -->
        <p>
        <?php $myFirstVariable = 0;
        echo $myFirstVariable; ?>
        </p>
    </body>
</html>

Codecademy Sample Solution: Strings


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
        <!-- Echo your string between the <p></p> tags! -->
        <p>
        <?PHP echo "A string " . "of my choice!"; ?>
        </p>
</body>
</html>

Codecademy Sample Solution: Arithmetic


<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
        <!-- Include your PHP code between the <p></p> tags! -->
        <p>
        <?PHP echo 17 * 123; ?>
        </p>  
</body>
</html>

Codecademy Sample Solution: Echo


<!DOCTYPE html>
<html>
    <head>
        <link type='text/css' rel='stylesheet' href='style.css'/>
<title>Hello, World!</title>
</head>
<body>
        <!-- Add your PHP code in the tag below! -->
        <h1><?php
            echo "I'm learning PHP!";
            ?></h1>
</body>
</html>

Codecademy Sample Solution: Just a New Tag


<!DOCTYPE html>
<html>
<head>
        <link type="text/css" rel="stylesheet" href="style.css"/>
<title>Summing Things Up</title>
</head>
<body>
        <p>
            <?php echo 40+2; ?>  
        </p>  
</body>
</html>

Codecademy Sample Solution: Why Learn PHP?


<!DOCTYPE html>
<html>
    <head>
        <link type='text/css' rel='stylesheet' href='style.css'/>
    <title>Get Started!</title>
</head>
<body>
        <p><?php echo "My first line of PHP!"; ?></p>
</body>
</html>

This is an example of scrolling text using Javascript.

Popular Posts