将下面的代碼儲存為asp檔案,images/babypic/為圖檔檔案路徑所在,01.jpg~06.jpg為圖像檔案。style=overflow:hidden;height:120;width:900中的定義高度和寬度。可以将該檔案包含在首頁即可。後面我準備寫一個直接可以管理的asp圖檔滾動代碼,即結合背景直接操場圖檔,并使用aspjpg元件自動生成小圖檔,而連結才打開大圖檔。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table width=700 border=0 cellpadding=0 cellspacing=0 align=center>
<tr><td>
<div id=demo style=overflow:hidden;height:120;width:900;color:#ffffff><table align=left cellpadding=0 cellspace=0 border=0><tr><td id=demo1 valign=top>
<table border=0 cellpadding=0 cellspacing=0 align =center>
<tr><td><a href="images/babypic/01.jpg" target="_blank"><img src=images/babypic/01.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td>
<td width=3></td>
<td><a href="images/babypic/02.jpg" target="_blank"><img src=images/babypic/02.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td></td>
<td><a href="images/babypic/03.jpg" target="_blank"><img src=images/babypic/03.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td>
<td><a href="images/babypic/04.jpg" target="_blank"><img src=images/babypic/04.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td>
<td><a href="images/babypic/05.jpg" target="_blank"><img src=images/babypic/05.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td>
<td><a href="images/babypic/06.jpg" target="_blank"><img src=images/babypic/06.jpg border=0 width=150 height=150 class=b5 hspace=0></a></td>
</tr>
</table>
</td><td id=demo2 valign=top></td></tr></table></div>
<script>
var speed=5//速度數值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
demo. {clearInterval(MyMar)}
demo. {MyMar=setInterval(Marquee,speed)}
</script>
</td></tr>
</table>
</body>
</html>
本文轉自 simeon2005 51CTO部落格,原文連結:http://blog.51cto.com/simeon/97136