js 实现上下滚动
html 上下滚动
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>���������ѭ�������Ĺ�����Ч��</title>
</head>
<body>
<table width="60" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=60 height=152>
<div class="RPR-P1">
<div class="RPR-P1-R2">
<div id="demo" style="overflow: hidden; width: 100%; height:152px; color:white; margin:0px;line-height:22px;">
<div id="demo1">
��<a href="javascript:alert('����')" style="text-decoration:none">����</a><br>
��<a href="javascript:alert('�Ͻ�')" style="text-decoration:none">�Ͻ�</a><br>
��<a href="javascript:alert('��ɳ')" style="text-decoration:none">��ɳ</a><br>
��<a href="javascript:alert('�ǹ�')" style="text-decoration:none">�ǹ�</a><br>
��<a href="javascript:alert('ƽ��')" style="text-decoration:none">ƽ��</a><br>
��<a href="javascript:alert('����')" style="text-decoration:none">����</a><br>
��<a href="javascript:alert('��')" style="text-decoration:none">��</a><br>
��<a href="javascript:alert('ǭ��')" style="text-decoration:none">ǭ��</a><br>
��<a href="javascript:alert('ƽ��')" style="text-decoration:none">ƽ��</a><br>
��<a href="javascript:alert('��ˮ')" style="text-decoration:none">��ˮ</a><br>
</div>
<div id="demo2">
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
<script>
var speed = 50
var _demo = document.getElementById("demo");
var _demo1 = document.getElementById("demo1");
var _demo2 = document.getElementById("demo2");
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>
</body>
</html>