Wednesday, 11 February 2015

Java Script Ineresting Programming

Divison Movement using Java Script

Divison is HTML tag which we used as an accumulater for other HTML control. We can apply many thing dynamicaly on a webpage using divison. Here I have write some text in divison and some css which made my divison more attractive . I have made display propety absolute which make me able to change its position using java script function, for implement timer like functionality which calls function continously using setTimeOut function and result is front of you.


<html>
<title>Girfa : Student Help</title>
<head>
<script language="javascript">  
    var i=0;
    function img_move()
    {                        
         var ob=document.getElementById('s1');
         i=parseInt(ob.style.top);
         i=i+5;
         ob.style.top=i+'px';       
         if(s1.style.top=='100px')
         {
        
            i=10;
             ob.style.top=i+'px';
         }
         s=setTimeout("img_move()",100);
     }
</script>
</head>
<body onload="img_move()">


<span style="height:50px;box-shadow:5px 5px 15px red;border-radius:10x;border:solid 3px red; width:110px;background-color:Teal;position:absolute;top:10px;left:20px;font-size:20px;color:white" id="s1">
<center>
Girfa<br>
Student Help
</span>
</center>
</body>