实现图片滚动的asp代码

将下面的代码保存为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 width=3></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 width=3></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

上一篇:【ASP.NET】判断访问网站的客户端是PC还是手机


下一篇:《跨境电商——速卖通搜索排名规则解析与SEO技术》一一第1章 速卖通搜索引擎与SEO技术