Change element left position : left : Style JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Style » left »

 

Change element left position

















<html>
<head>
<style>
div position:relative;
}
</style>

<title>Animating Text</title>
<SCRIPT LANGUAGE="JavaScript" type = "text/javascript">
var pos1 = 0;

function f() {
    pos1 += 5;
    if (pos1 > 640)
       pos1 = 0;
    document.getElementById("movetext").style.left = pos1;
    window.setTimeout("f();",300);
}
</SCRIPT>
</head>
<body onLoad="f();">
<div id="movetext">
<b>inside a div</b>
</div>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Style
» left