html页面结构:
<span style="font-size:14px;"><div id="Hc_demo" class="Hc_review_out">
<div id="Hc_demo1">
<dl>
<dt><span>2014-10-12</span><b>小明</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容111111111111111111111111111111111111111111111111111111</dd>
</dl>
<dl>
<dt><span>2014-10-12</span><b>小芬</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容22222222222222222222222222</dd>
</dl>
<dl>
<dt><span>2014-10-12</span><b>阿明</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容333333333333333333333</dd>
</dl>
<dl>
<dt><span>2014-10-12</span><b>小王</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容44444444444444444444444444</dd>
</dl>
<dl>
<dt><span>2014-10-12</span><b>小张</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容5555555555555555555555555</dd>
</dl>
<dl>
<dt><span>2014-10-12</span><b>小明</b></dt>
<dd><img src="images/Hc_icon1.jpg" />评论人评论内容6666666666666666666666666</dd>
</dl>
</div>
<div id="Hc_demo2"></div>
</div></span>
js代码:
<span style="font-size:14px;"> <script type="text/javascript">
// JavaScript Document 首页
var Hcspeed=30;
var HcDemo=document.getElementById('Hc_demo');
var HcDemo1=document.getElementById('Hc_demo1');
var HcDemo2=document.getElementById('Hc_demo2');
HcDemo2.innerHTML=HcDemo1.innerHTML
function HcMarquee(){
if(HcDemo2.offsetHeight-HcDemo.scrollTop<=0){
HcDemo.scrollTop-=HcDemo1.offsetHeight;
alert (HcDemo2.offsetHeight)
}
else{
HcDemo.scrollTop++
}
}
var HcMyMar=setInterval(HcMarquee,Hcspeed)
HcDemo.οnmοuseοver=function() {clearInterval(HcMyMar)}
HcDemo.οnmοuseοut=function() {HcMyMar=setInterval(HcMarquee,Hcspeed)}
</script></span>