网页设计 图片滚动代码
<divid=demostyle="width:200px;overflow:200px;hidden:200px;"><tablewidth="100%"border=...
<div id=demo style="width:200px; overflow:200px;hidden:200px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id=demo1>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="16%" valign="top"><img src="123.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="u=2071069162,3140365922&fm=59.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="114.jpg" width="301" height="267" border="0" /></td>
<td width="16%" valign="top"><img src="u=1591479215,543162922&fm=23&gp=0.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="u=1160761241,3158904811&fm=21&gp=0.jpg" width="256" height="265" border="0" /></td>
<td width="14%" valign="top"> </td>
</tr>
</table>
</td>
<td id=demo2><p> </p></td>
</tr>
</table>
</div>
<script>
var speed=20;
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){
if(document.getElementById("demo2").offsetWidth-document.getElementById("demo").scrollLeft<=0)
document.getElementById("demo").scrollLeft-=document.getElementById("demo1").offsetWidth
else{
document.getElementById("demo").scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
为神魔我把这个代码弄上之后,图片不滚动。。~~~~(>_<)~~~~ 展开
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id=demo1>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="16%" valign="top"><img src="123.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="u=2071069162,3140365922&fm=59.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="114.jpg" width="301" height="267" border="0" /></td>
<td width="16%" valign="top"><img src="u=1591479215,543162922&fm=23&gp=0.jpg" width="256" height="265" border="0" /></td>
<td width="16%" valign="top"><img src="u=1160761241,3158904811&fm=21&gp=0.jpg" width="256" height="265" border="0" /></td>
<td width="14%" valign="top"> </td>
</tr>
</table>
</td>
<td id=demo2><p> </p></td>
</tr>
</table>
</div>
<script>
var speed=20;
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){
if(document.getElementById("demo2").offsetWidth-document.getElementById("demo").scrollLeft<=0)
document.getElementById("demo").scrollLeft-=document.getElementById("demo1").offsetWidth
else{
document.getElementById("demo").scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
为神魔我把这个代码弄上之后,图片不滚动。。~~~~(>_<)~~~~ 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询