Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

ranjan

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Javascript Motion tween

// description of your code here
// Motion tween

   1  
   2  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   3          "http://www.w3.org/TR/html4/loose.dtd">
   4  <html>
   5  <head>
   6  
   7    <script type="text/javascript">
   8        var pos=0;
   9  
  10          function move(){
  11              pos = 0;
  12              changeInnerHtml();
  13              setTimeout('move()',1000);
  14              pos = 0 ;
  15  
  16          }
  17  
  18          function changeInnerHtml()
  19          {
  20  
  21                pos = pos +5;
  22                document.getElementById('spid').style.visibility = 'hidden';
  23  //              document.getElementById('div1').style.visibility = 'hidden';
  24  
  25                if( pos <= 200 )
  26                {
  27  
  28                    document.getElementById('b1').style.left = pos + 'px';
  29                    setTimeout("changeInnerHtml()",10);
  30  
  31                }
  32  
  33                
  34             }
  35            
  36  
  37                      
  38  //            document.getElementById('div1').innerHTML = '';
  39  //            document.getElementById('div1').innerHTML = '<input type = "text" name = "hi" />' ;                      }
  40         
  41  
  42    </script>
  43  
  44    <style type="text/css">
  45        .divstyle
  46        {
  47  
  48           width:50px;
  49           height:50px;
  50           position:relative;
  51           left:100px;
  52           border:1px;
  53           visibility:visible;
  54  
  55            
  56        }
  57        
  58    </style>
  59    <title></title>
  60  </head>
  61  <body>
  62  
  63      <div id="div1">
  64          <span id="spid" class="divstyle">
  65              hi
  66          </span>
  67          <input type="submit" id="b1" name="b1" onclick="move()" class="divstyle"/>
  68          <iframe id="iframe1" class="div1" >
  69              
  70          </iframe>
  71      </div>
  72  
  73  </body>
  74  </html>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS