逐梦论坛's Archiver

shillan 发表于 2006-11-14 23:22

不间断滚动图片

<div><br>
<div id=demo style="overflow: hidden; width: 150px; height: 200px">
<div id=demo1><img src="http://www.toto369.net/txtx/17/1.jpg"><br><img src="http://www.toto369.net/txtx/17/2.jpg"><br><img src="http://www.toto369.net/txtx/17/3.jpg"><br><img src="http://www.toto369.net/txtx/17/4.jpg"><br><img src="http://www.toto369.net/txtx/17/5.jpg"><br></div>
<div id=demo2><img src="http://www.toto369.net/txtx/17/1.jpg"><br><img src="http://www.toto369.net/txtx/17/2.jpg"><br><img src="http://www.toto369.net/txtx/17/3.jpg"><br><img src="http://www.toto369.net/txtx/17/4.jpg"><br><img src="http://www.toto369.net/txtx/17/5.jpg"><br></div></div>
<script>
var speed=30;
demo2.innerhtml=demo1.innerhtml
function marquee()
{
        if(demo2.offsettop-demo.scrolltop<=0)
                demo.scrolltop-=demo1.offsetheight;
        else
                demo.scrolltop++;
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
</script>

<script>
var speed=30;
demo2.innerhtml=demo1.innerhtml
function marquee()
{
        if(demo2.offsettop-demo.scrolltop<=0)
                demo.scrolltop-=demo1.offsetheight;
        else
                demo.scrolltop++;
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
</script>
</div>加入如下代码到body区域<br><textarea class=yk9 name=source rows=12 cols=100>&lt;div id=demo style=overflow:hidden;height:200;width:150&gt;
&lt;div id=demo1&gt;
&lt;img src='17/1.jpg'&gt;&lt;br&gt;
&lt;img src='17/2.jpg'&gt;&lt;br&gt;
&lt;img src='17/3.jpg'&gt;&lt;br&gt;
&lt;img src='17/4.jpg'&gt;&lt;br&gt;
&lt;img src='17/5.jpg'&gt;&lt;br&gt;
&lt;/div&gt;
&lt;div id=demo2&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script&gt;
var speed=30;
demo2.innerhtml=demo1.innerhtml
function marquee()
{
if(demo2.offsettop-demo.scrolltop&lt;=0)
demo.scrolltop-=demo1.offsetheight;
else
demo.scrolltop++;
}
var mymar=setinterval(marquee,speed)
demo.onmouseover=function() {clearinterval(mymar)}
demo.onmouseout=function() {mymar=setinterval(marquee,speed)}
&lt;/script&gt;</textarea> <br><input onclick=source.select() type=button value=选取代码 name=b2>
<script language=javascript>
<!--
function closeclk() {
another=close();
}
//-->
        </script>
<input onclick=closeclk() type=button value=关闭窗口 name=b22>

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.