lingzhi12
路人甲
路人甲
  • 注册日期2004-07-30
  • 发帖数240
  • QQ
  • 铜币60枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1524回复:1

[转帖]在活动窗口中从左到右每次显示一个图库中的图片

楼主#
更多 发布于:2004-10-06 21:17
<P>说明:在活动窗口中从左到右每次显示一个图库中的图片,每个图片中间都有一个停顿,你也可以为每个图片添加链接。</P>
<P>将以下代码加入<body>区域:
<script language="JavaScript1.2"></P>
<P>///////configure the below four variables to change the style of the slider///////
//set the scrollerwidth and scrollerheight to the width/height of the LARGEST image in your slideshow!
var scrollerwidth='150px'
var scrollerheight='100px'
var scrollerbgcolor='white'
//3000 miliseconds=3 seconds
var pausebetweenimages=3000</P>
<P>
//configure the below variable to change the images used in the slideshow. If you wish the images to be clickable, simply wrap the images with the appropriate <a> tag
var slideimages=new Array()
slideimages[0]='<a href="<a href='http://www.smallrain.net" target="_blank" ><img'>http://www.smallrain.net"><img</A> src="jsimg/1.jpg" border=0"></a>'
slideimages[1]='<img src="jsimg/2.jpg">'
slideimages[2]='<img src="jsimg/3.jpg">'
slideimages[3]='<img src="jsimg/4.jpg">'
slideimages[4]='<img src="jsimg/5.jpg">'
//extend this list</P>
<P>///////Do not edit pass this line///////////////////////
    
var ie=document.all
var dom=document.getElementById</P>
<P>if (slideimages.length>1)
i=2
else
i=0</P>
<P>function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.left>0;;tlayer.left<=5){
tlayer.left=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.left>=tlayer.document.width*-1){
tlayer.left-=5
setTimeout("move1(tlayer)",50)
}
else{
tlayer.left=parseInt(scrollerwidth)+5
tlayer.document.write(slideimages)
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}</P>
<P>function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.left>0;;tlayer2.left<=5){
tlayer2.left=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.left>=tlayer2.document.width*-1){
tlayer2.left-=5
setTimeout("move2(tlayer2)",50)
}
else{
tlayer2.left=parseInt(scrollerwidth)+5
tlayer2.document.write(slideimages)
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}
}</P>
<P>function move3(whichdiv){
tdiv=eval(whichdiv)
if (parseInt(tdiv.style.left)>0;;parseInt(tdiv.style.left)<=5){
tdiv.style.left=0+"px"
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(scrollerdiv2)",pausebetweenimages)
return
}
if (parseInt(tdiv.style.left)>=tdiv.offsetWidth*-1){
tdiv.style.left=parseInt(tdiv.style.left)-5+"px"
setTimeout("move3(tdiv)",50)
}
else{
tdiv.style.left=scrollerwidth
tdiv.innerHTML=slideimages
if (i==slideimages.length-1)
i=0
else
i++
}
}</P>
<P>function move4(whichdiv){
tdiv2=eval(whichdiv)
if (parseInt(tdiv2.style.left)>0;;parseInt(tdiv2.style.left)<=5){
tdiv2.style.left=0+"px"
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(scrollerdiv1)",pausebetweenimages)
return
}
if (parseInt(tdiv2.style.left)>=tdiv2.offsetWidth*-1){
tdiv2.style.left=parseInt(tdiv2.style.left)-5+"px"
setTimeout("move4(scrollerdiv2)",50)
}
else{
tdiv2.style.left=scrollerwidth
tdiv2.innerHTML=slideimages
if (i==slideimages.length-1)
i=0
else
i++
}
}</P>
<P>function startscroll(){
if (ie||dom){
scrollerdiv1=ie? first2 : document.getElementById("first2")
scrollerdiv2=ie? second2 : document.getElementById("second2")
move3(scrollerdiv1)
scrollerdiv2.style.left=scrollerwidth
}
else if (document.layers){
document.main.visibility='show'
move1(document.main.document.first)
document.main.document.second.left=parseInt(scrollerwidth)+5
document.main.document.second.visibility='show'
}
}</P>
<P>window.onload=startscroll</P>
<P></script></P>

<P>
<ilayer id="main" width=;{scrollerwidth}; height=;{scrollerheight}; bgColor=;{scrollerbgcolor}; visibility=hide>
<layer id="first" left=1 top=0 width=;{scrollerwidth}; >
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[0])
</script>
</layer>
<layer id="second" left=0 top=0 width=;{scrollerwidth}; visibility=hide>
<script language="JavaScript1.2">
if (document.layers)
document.write(slideimages[1])
</script>
</layer>
</ilayer></P>
<P><script language="JavaScript1.2">
if (ie||dom){
document.writeln('<div id="main2" style="position:relative;width:'+scrollerwidth+';height:'+scrollerheight+';overflow:hidden;background-color:'+scrollerbgcolor+'">')
document.writeln('<div style="position:absolute;width:'+scrollerwidth+';height:'+scrollerheight+';clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')
document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:1px;top:0px;">')
document.write(slideimages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px">')
document.write(slideimages[1])
document.writeln('</div>')
document.writeln('</div>')
document.writeln('</div>')
}
</script>
      </P>
喜欢0 评分0
淡泊明志,宁静致远
eeleo_Lion
论坛版主
论坛版主
  • 注册日期2003-11-29
  • 发帖数1798
  • QQ
  • 铜币551枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-10-10 09:59
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em12.gif" /><img src="images/post/smile/dvbbs/em12.gif" />
人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部