Moving text by changing CSS style left property - Javascript CSS Style Property

Javascript examples for CSS Style Property:left

Description

Moving text by changing CSS style left property

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
 function move() {/*from w  w w  .  j  a  va 2s .  c o  m*/
        divElement = document.getElementById("MovingContent");
        divElement.style.left = parseInt(divElement.style.left)+1+"px";
    }
window.onload= function(){
  setInterval('move()', 1000);
 }

      </script> 
   </head> 
   <body> 
      <div style="left:0px;position:absolute;" id="MovingContent">
          moving data 
      </div>  
   </body>
</html>

Related Tutorials