1、javascript代码部分
复制代码 代码示例:
<script type="text/javascript">
var speed1=30; //控制速度,数越多速度越慢
demon2.innerHTML=demon1.innerHTML;
function Marquee()
{
if(demon.scrollLeft>=demon1.scrollWidth)
{
demon.scrollLeft=0;
}
else
{
demon.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed1);
demon.onmouseover=function() {clearInterval(MyMar)}
demon.onmouseout=function() {MyMar=setInterval(Marquee,speed1)}
</script>
2、页面内容部分
复制代码 代码示例:
<div id="demon" style="overflow: hidden; width: 500px; background-color: #FFFFFF;">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td id="demon1" valign="top">
<table cellspacing="0" cellpadding="0" width="500" border="0">
<tr>
<td><a href="" target="_blank">
<img src="images/newton09-apple.png" class="tu" border="0" /></a>
</td>
<td><a href="" target="_blank">
<img src="images/newton09-apple.png" class="tu" border="0" /></a>
</td>
<td><a href="" target="_blank">
<img src="images/newton09-apple.png" class="tu" border="0" /></a>
</td>
<td><a href="" target="_blank">
<img src="images/newton09-apple.png" class="tu" border="0" /></a>
</td>
<td><a href="" target="_blank">
<img src="images/newton09-apple.png" class="tu" border="0" /></a>
</td>
</tr>
</table>
</td>
<td id="demon2"></td>
</tr>
</table>
</div>
有兴趣的朋友,可以亲自测试下,看看这个图片滚动的效果如何?!