ze1d Posted October 13, 2007 Share Posted October 13, 2007 Hi all,In this code I should move the "Welcome" text from left to right using a timer: <html><head><script type="text/javascript">var step = 5;var count = 0;function start(){window.setInterval("run()", 100);}function run(){count += step;ptext.style.left = count;if (count >= 160 || count <= 0){step *= -1;}</script></head><body onload="start()"><p id="ptext" style="position:absolute;">Welcome</p></body></html> But i don't know whats wrong with it, it's giving me "Object expected" error on the line: <body onload="start()">Thanks very much,zeid Link to comment Share on other sites More sharing options...
Synook Posted October 14, 2007 Share Posted October 14, 2007 You forgot the final closing brace after the run() function. Add another } right before the </script> tag. function run(){count += step;ptext.style.left = count;if (count >= 160 || count <= 0){step *= -1;}} Link to comment Share on other sites More sharing options...
ze1d Posted October 14, 2007 Author Share Posted October 14, 2007 Thanks very much i didn't see that Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.