循环移动的广告条 |
|
将下面的原代码加入<head></head>之间:
<script language='javascript'> function moveIt() { if(document.layers) { document.redball.left += 5; if (document.redball.left>600) { document.redball.left = 0; } } else if (document.all) { redball.style.left = parseInt(redball.style.left) + 5; if (parseInt(redball.style.left) > 600) { redball.style.left =0; } } if ((document.layers) || (document.all)) { setTimeout('moveIt()', 50); } } </script> <script language='javascript'> function moveIt() { if(document.layers) { document.redball.left += 5; if (document.redball.left>600) { document.redball.left = 0; } } else if (document.all) { redball.style.left = parseInt(redball.style.left) + 5; if (parseInt(redball.style.left) > 600) { redball.style.left =0; } } if ((document.layers) || (document.all)) { setTimeout('moveIt()', 50); } } </script> 修改<body>语句为: <body onload='moveIt()'> 将下面的代码加入<body></body>之间需要的地方: <div id='redball' style='position:relative; left:0px; width:350px; height:45px;'><p align='left'><img src='1.gif' alt='移动的广告条' WIDTH='250' HEIGHT='60'><br> </p> </div> 其中的'5'是移动的步长,600是移动距离,可以自己调整 |