关于JS图片循环向左滚动
<divid="scroll"><scripttype="text/javascript"><!--varsliderwidth=484varsliderheight=1...
<div id="scroll">
<script type="text/javascript">
<!--
var sliderwidth=484
var sliderheight=133
var slidespeed=4
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[1]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[2]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[3]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[4]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[5]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[6]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[7]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[8]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[9]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[10]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
var copyspeed=slidespeed
for (i=0;i<leftrightslide.length;i++)
finalslide=finalslide+leftrightslide[i]+" "
if (document.all){
document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
}
function regenerate(){
window.location.reload()
}
function regenerate112(){
if (document.layers){
document.ns_slider01.visibility="show"
setTimeout("window.onresize=regenerate",450)
intializeleftrightslide()
}
if (document.all)
ieslider.scrollAmount=slidespeed
}
function intializeleftrightslide(){
document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
document. ns_slider01.document.ns_slider02.document.close()
thelength=document.ns_slider01.document.ns_slider02.document.width
scrollslide()
}
function scrollslide(){
if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1)){
document.ns_slider01.document.ns_slider02.left-=slidespeed
setTimeout("scrollslide()",100)
}
else{
document.ns_slider01.document.ns_slider02.left=sliderwidth
scrollslide()
}
}
window.onload=regenerate112
//-->
</script>
</div>
为什么单独放一个文件里显示正常,嵌套在一个完整的网页中却是当第一个图片滚动到左边时又重新开始滚动呢?
用marquee标签也是一样的 展开
<script type="text/javascript">
<!--
var sliderwidth=484
var sliderheight=133
var slidespeed=4
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[1]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[2]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[3]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[4]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[5]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[6]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[7]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[8]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[9]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
leftrightslide[10]='<a href="#"><img src="/ad/zzjs.gif" width="138" height="102" border=1></a>'
var copyspeed=slidespeed
for (i=0;i<leftrightslide.length;i++)
finalslide=finalslide+leftrightslide[i]+" "
if (document.all){
document.write('<marquee id="ieslider" scrollAmount=0 style="width:'+sliderwidth+'">'+finalslide+'</marquee>')
ieslider.onmouseover=new Function("ieslider.scrollAmount=0")
ieslider.onmouseout=new Function("if (document.readyState=='complete') ieslider.scrollAmount=slidespeed")
}
function regenerate(){
window.location.reload()
}
function regenerate112(){
if (document.layers){
document.ns_slider01.visibility="show"
setTimeout("window.onresize=regenerate",450)
intializeleftrightslide()
}
if (document.all)
ieslider.scrollAmount=slidespeed
}
function intializeleftrightslide(){
document.ns_slider01.document.ns_slider02.document.write('<nobr>'+finalslide+'</nobr>')
document. ns_slider01.document.ns_slider02.document.close()
thelength=document.ns_slider01.document.ns_slider02.document.width
scrollslide()
}
function scrollslide(){
if (document.ns_slider01.document.ns_slider02.left>=thelength*(-1)){
document.ns_slider01.document.ns_slider02.left-=slidespeed
setTimeout("scrollslide()",100)
}
else{
document.ns_slider01.document.ns_slider02.left=sliderwidth
scrollslide()
}
}
window.onload=regenerate112
//-->
</script>
</div>
为什么单独放一个文件里显示正常,嵌套在一个完整的网页中却是当第一个图片滚动到左边时又重新开始滚动呢?
用marquee标签也是一样的 展开
2011-01-07
展开全部
这里有一个无缝滚动效果
方向可以自己设置
可以设置定高定宽停顿
你把文字改成图片就行
里面有源码可以参考
方向可以自己设置
可以设置定高定宽停顿
你把文字改成图片就行
里面有源码可以参考
参考资料: http://www.blueidea.com/common/shoutbox/redir.asp?7=y&id=12229
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询