截图:
运行代码
<BODY> <div id='div1' style="border:1px solid #c0c0c0;width:293px;height:66px;overflow:hidden;position:absolute;top:100px;left:100px;"> <div id="first" style="position:absolute;;top:2px;left:2px;height:64px;width:289px;"> <img src="http://i2.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F1070DT20080704163744.jpg" width="90" height="60" alt="古楼遗风" /> <img src="http://i2.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F3303DT20080704164135.jpg" width="90" height="60" alt="夕光涟潋" /> <img src="http://i3.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F3304DT20080704164656.jpg" width="90" height="60" alt="爱之缠绵" /> </div> <div id="second" style="position:absolute;top:2px;left:294px;height:64px;width:289px;"> <img src="http://i1.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F3305DT20080704165504.jpg" width="90" height="60" alt="欢乐瞬间" /> <img src="http://i2.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F3306DT20080704171426.jpg" width="90" height="60" alt="台岛奇观" /> <img src="http://i3.sinaimg.cn/IT/images/2008-07-04/U1960P2T78D12794F3307DT20080704173213.jpg" width="90" height="60" alt="天堑变通途" /> </div> </div> </BODY> </HTML> <SCRIPT LANGUAGE="JavaScript"> <!-- var d=document,f = d.getElementById('first'),s = d.getElementById('second'); function move(){ var timer = setInterval(function(){ if(s.offsetLeft+s.offsetWidth<0||f.offsetLeft+f.offsetWidth<0){ clearInterval(timer); f.offsetLeft+f.offsetWidth<0?(f.style.left = s.offsetLeft + s.offsetWidth +2+ 'px'):(s.style.left = f.offsetLeft + f.offsetWidth +4+ 'px') setTimeout(move,2000); } else{ f.style.left = f.offsetLeft - 2 + 'px'; s.style.left = s.offsetLeft - 2 + 'px'; } },10) } setTimeout(move,2000); //--> </SCRIPT> 提示:您可以先修改部分代码再运行
请您注意: ·不良评论请用报告管理员,以利管理员及时删除。 ·尊重网上道德,遵守中华人民共和国的各项有关法律法规 ·承担一切因您的行为而直接或间接导致的民事或刑事法律责任 ·本站评论管理人员有权保留或删除其管辖评论中的任意内容 ·您在本站发表的作品,本站有权在网站内转载或引用 ·参与本评论即表明您已经阅读并接受上述条款