一个网页如何插入两个同样效果的js 插入后两段都不显示了,下面是代码,可以顺便帮我改一下吗?
<DIVid=demostyle="OVERFLOW:hidden;WIDTH:762px;HEIGHT:165px"><tablecellPadding=0align=...
<DIV id=demo style="OVERFLOW: hidden; WIDTH: 762px; HEIGHT: 165px">
<table cellPadding=0 align=center border=0 cellspace="0">
<tr>
<td id=demo1 vAlign=top><%=TopProducts()%> </td>
<td id=demo2 vAlign=top></td>
</tr>
</table>
<SCRIPT>
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
} }
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</SCRIPT>
</div> 展开
<table cellPadding=0 align=center border=0 cellspace="0">
<tr>
<td id=demo1 vAlign=top><%=TopProducts()%> </td>
<td id=demo2 vAlign=top></td>
</tr>
</table>
<SCRIPT>
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
} }
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
</SCRIPT>
</div> 展开
2个回答
展开全部
调用
scrollfn(document.getElementById("demo2"),document.getElementById("demo1"))
scrollfn(document.getElementById("xx2"),document.getElementById("xx1"))
封成方法
function scrollfn(demo2,demo1){
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
} }
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
}
scrollfn(document.getElementById("demo2"),document.getElementById("demo1"))
scrollfn(document.getElementById("xx2"),document.getElementById("xx1"))
封成方法
function scrollfn(demo2,demo1){
var speed=20
demo2.innerHTML=demo1.innerHTML
function Marquee1(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
} }
var MyMar1=setInterval(Marquee1,speed)
demo.onmouseover=function() {clearInterval(MyMar1)}
demo.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询