里面三张图片分别是:BJ.BMP,NK.BMP,TJ.BMP,TSINGHUA.BMP 自己弄几张图片改名就能看到效果了 <html> <head> <title> 循环滚动的超级链接图片 </title> <META content="text/html; charset=gb2312" http-equiv=Content-Type> <META content="MSHTML 5.00.2919.6307" name=GENERATOR> <mce:script language=JavaScript1.2><!-- //设置滚动图片的宽度 var width; width=200; //设置滚动图片的高度 var height; height=100; //设置背景色 var bgcolor; bgcolor='#ccffcc' //每个图间暂停3秒。 var stop=3000; //定义一组大小一样的图片 var images; images=new Array() images[0]='<a href="http://www.nankai.edu.cn" mce_href="http://www.nankai.edu.cn"><img src="nk.bmp" mce_src="nk.bmp" border=0></a>'; images[1]='<a href="http://www.tju.edu.cn" mce_href="http://www.tju.edu.cn"><img src="tj.bmp" mce_src="tj.bmp" border=0></a>'; images[2]='<a href="http://www.tsinghua.edu.cn" mce_href="http://www.tsinghua.edu.cn"><img src="tsinghua.bmp" mce_src="tsinghua.bmp" border=0></a>'; images[3]='<a href="http://www.pku.edu.cn" mce_href="http://www.pku.edu.cn"><img src="bj.bmp" mce_src="bj.bmp" border=0></a>'; //如果图片数大于1 if (images.length>1) { i=2; } //否则,如果图片数不大于1 else{ i=0; } function move1(whichlayer) { //取得移动队像 tlayer=eval(whichlayer) //如果该对象的上边界大于0且小于等于5 if(tlayer.top>0&&tlayer.top<=5) { //设置上边界为0 tlayer.top=0; //3秒后执行move1函数 setTimeout("move1(tlayer)",stop); //3秒后执行move2函数 setTimeout("move2(document.main.document.second)",stop); return } if (tlayer.top>=tlayer.document.height*-1) { tlayer.top-=5 //100毫秒后执行move1函数 setTimeout("move1(tlayer)",100) } else{ //设置该对象的上边界 tlayer.top=height //设置该对象内容 tlayer.document.write(images[i]) //关闭该对象文档 tlayer.document.close() if (i==images.length-1) { i=0 } else{ i++ } } } function move2(whichlayer) { //取得相应的对象 tlayer2=eval(whichlayer) if (tlayer2.top>0&&tlayer2.top<=5) { //设置该对象上边界为0 tlayer2.top=0 //3秒后执行move2函数 setTimeout("move2(tlayer2)",stop); //3秒后执行move1函数 setTimeout("move1(document.main.document.first)",stop) return } if (tlayer2.top>=tlayer2.document.height*-1) { //使该对象的上边界减小5 tlayer2.top-=5 //100毫秒后执行move2 setTimeout("move2(tlayer2)",100) } else{ //设置对象上边界 tlayer2.top=height //设置该对象内容 tlayer2.document.write(images[i]) //关闭该对象文档 tlayer2.document.close() if (i==images.length-1) { i=0 } else{ i++ } } } function move3(whichdiv) { //取得相应的对象 tdiv=eval(whichdiv) if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=5) { //设置对象的上边界 tdiv.style.pixelTop=0 //3秒后执行move3 setTimeout("move3(tdiv)",stop) //3秒后执行move4 setTimeout("move4(second2)",stop) return } if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1) { //使该对象的上边界减小5 tdiv.style.pixelTop-=5 //100毫秒后执行move3 setTimeout("move3(tdiv)",100) } else{ //设置对象上边界 tdiv.style.pixelTop=height //设置对象内容 tdiv.innerHTML=images[i] if (i==images.length-1) { i=0 } else{ i++ } } } function move4(whichdiv) { //取得相应的对象 tdiv2=eval(whichdiv) if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=5) { //设置对象的上边界 tdiv2.style.pixelTop=0 //3秒后执行move4 setTimeout("move4(tdiv2)",stop) //3秒后执行move3 setTimeout("move3(first2)",stop) return } if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1) { //使该对象的上边界减小5 tdiv2.style.pixelTop-=5 //100毫秒后执行move4 setTimeout("move4(second2)",100) } else{ //设置对象上边界 tdiv2.style.pixelTop=height //设置对象内容 tdiv2.innerHTML=images[i] if (i==images.length-1) { i=0 } else{ i++ } } } //定义用于开始滚动的函数 function startscroll() { //如果支持document.all,说明是IE浏览器 if (document.all) { //调用前面定义的move3 move3(first2); //设置第二个对象的上边界 second2.style.top=height; return; } //如果是Netscape浏览器 else if (document.layers) { //调用move1 move1(document.main.document.first); //增加对象的上边界 document.main.document.second.top=height+5; //设置对象可见 document.main.document.second.visibility='show'; return; } //如果不是上面的这两种浏览器 else{ //弹出警告信息 alert("请使用Internet Explore浏览器或Netscape Navigator浏览器浏览本页面!"); return; } } // --></mce:script> </head> <body onload="startscroll()"> <ILAYER id=main bgcolor="&{bgcolor};" height="&{height};" width="&{width};"> <LAYER id=first width="&{width};" top="1" left="0"> <mce:script language=JavaScript1.2><!-- //如果时Netscape浏览器 if (document.layers) { //写入第一个图像 document.write(images[0]) } // --></mce:script> </LAYER> <LAYER id=second width="&{width};" top="0" left="0" visibility="hide"> <mce:script language=JavaScript1.2><!-- //如果是Netscape浏览器 if (document.layers) { //写入第二个图像 document.write(images[1]) } // --></mce:script> </LAYER> </ILAYER> <P> <mce:script language=JavaScript1.2><!-- //如果是IE浏览器 if (document.all) { //写入页面内容 document.writeln('<span id="main2" style="position:relative; width:'+width+'; height:'+height+'; overflow:hiden; background-color:'+bgcolor+'">'); document.writeln('<div style="position:absolute; width:'+width+'; height:'+height+'; clip:rect(0 '+width+' '+height+' 0); left:0; top:0">'); document.writeln('<div id="first2" style="position:absolute;width:'+width+';left:0;top:1;">'); document.write(images[0]); document.writeln('</div>'); document.writeln('<div id="second2" style="position:absolute;width:'+width+';left:0;top:0">'); document.write(images[1]); document.writeln('</div>'); document.writeln('</div>'); document.writeln('</span>'); } // --></mce:script> </P> </body> </html>