尝试了很多次,还是没写出来 stop()和start(),上来请教。
文字是在滚动的,点击停止按钮,文字滚动停止,当点击开始,文字开始滚动<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>向上滚动</title>
<style>
a{display:block;line-height:18px;text-decoration:none;color:#555;font-family:Arial;font-size:12px;}
.shell{ border:1px solid #aaa;
width:230px;
padding:3px 2px 2px 26px;
}
#div1{
height:18px;
overflow:hidden;
}
</style>
</head>
<body>
<div class="shell">
<div id="div1">
<a href="javascript:">字体滚动1</a>
<a href="javascript:">字体滚动2</a>
<a href="javascript:">字体滚动3</a>
<a href="javascript:">字体滚动4</a>
<a href="javascript:">字体滚动5</a>
</div>
<br/>
<input type="button" value="开始" onclick="start()" />
<input type="button" value="停止" onclick="stop()" />
<div>
</body>
<script>
var c,_=Function;
with(o=document.getElementById("div1")){ innerHTML+=innerHTML; onmouseover=_("c=1"); onmouseout=_("c=0");}
(F=_("if(#%18||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%18?10:2500);".replace(/#/g,"o.scrollTop")))();
</script>
</html>
文字是在滚动的,点击停止按钮,文字滚动停止,当点击开始,文字开始滚动<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>向上滚动</title>
<style>
a{display:block;line-height:18px;text-decoration:none;color:#555;font-family:Arial;font-size:12px;}
.shell{ border:1px solid #aaa;
width:230px;
padding:3px 2px 2px 26px;
}
#div1{
height:18px;
overflow:hidden;
}
</style>
</head>
<body>
<div class="shell">
<div id="div1">
<a href="javascript:">字体滚动1</a>
<a href="javascript:">字体滚动2</a>
<a href="javascript:">字体滚动3</a>
<a href="javascript:">字体滚动4</a>
<a href="javascript:">字体滚动5</a>
</div>
<br/>
<input type="button" value="开始" onclick="start()" />
<input type="button" value="停止" onclick="stop()" />
<div>
</body>
<script>
var c,_=Function;
with(o=document.getElementById("div1")){ innerHTML+=innerHTML; onmouseover=_("c=1"); onmouseout=_("c=0");}
(F=_("if(#%18||!c)#++,#%=o.scrollHeight>>1;setTimeout(F,#%18?10:2500);".replace(/#/g,"o.scrollTop")))();
</script>
</html>
function ss(){
document.getElementById("test").stop();
}
function kk(){
document.getElementById("test").start();
}
</script>
</head>
<body>
<marquee id="test" behavior="scroll" loop="-1" direction="left" onmouseover=this.stop()><a href="#">test1</a></marquee>
<input type="button" onclick="ss()" value="stop">
<input type="button" onclick="kk()" value="start">
这样试试
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>向上滚动</title>
<style>
a{display:block;line-height:18px;text-decoration:none;color:#555;font-family:Arial;font-size:12px;}
.shell{ border:1px solid #aaa;
width:230px;
padding:3px 2px 2px 26px;
}
#div1{
height:18px;
overflow:hidden;
}
</style>
</head>
<body>
<div class="shell">
<div id="div1">
<a href="javascript:">字体滚动1</a>
<a href="javascript:">字体滚动2</a>
<a href="javascript:">字体滚动3</a>
<a href="javascript:">字体滚动4</a>
<a href="javascript:">字体滚动5</a>
</div>
<br/>
<input type="button" value="开始" onclick="starts();" />
<input type="button" value="停止" onclick="stops();" />
<div>
</body>
<script>
var c,_=Function;
with(o=document.getElementById("div1")){ innerHTML+=innerHTML; onmouseover=_("c=1"); onmouseout=_("c=0");}
(F=_("if(#%18||!c)#++,#%=o.scrollHeight>>1;s=setTimeout(F,#%18?10:2500);".replace(/#/g,"o.scrollTop")))();
function stops() {
clearTimeout(s);
}
function starts() {
clearTimeout(s);
F();
}
</script>
</html>