日期:2014-05-17 浏览次数:20794 次
<div id="dvvv" style="overflow: hidden; height: 27px; width: 750px;">
<div id="dvvv1">
<ul style="padding-left: 0px; margin-top: 0px;">
<li style="list-style-type: none;white-space:nowrap">
中文为什么就不行,中文为什么就不行中文为.什么就不行中文为什么就不行中文,为什么就不行中。文为什么。就不行中文为什么就不行中文为什。么就不行中文为什么就不行中文为什么就不行中文为什么就不行中文为什么就不行。中文为什么。就不行中文为什么就不行中文。为什么就不行中文为什么就不。行中文为什么就不行中。文为什么就不行中文为什么就。不行中文为什。么就不行中文为什么。就不行么就不行中文为什么就不行中文为什么就不行。中文为什么。就不行中文为什么就不行中文。为什么就不行中文为什么就不。行中文为什么就不行中。文为什么就不行中文为什么就。不行中文为什。么就不行中文为什么。就不行</li>。
</ul>
</div>
<div id="dvvv2">
</div>
</div>
<script type="text/javascript">
var speded=30
dvvv2.innerHTML=dvvv1.innerHTML
function Marqpuee(){
if(dvvv2.offsetWidth-dvvv.scrollLeft<=0)
dvvv.scrollLeft-=dvvv1.offsetWidth
else{
dvvv.scrollLeft++
}
}
var MyMmar=setInterval(Marqpuee,speded)
dvvv.onmouseover=function() {clearInterval(MyMmar)}
dvvv.onmouseout=function() {MyMmar=setInterval(Marqpuee,speded)}
</script>
------解决方案--------------------
lz 要的应该是无缝滚动代码,看看:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>竖向向无缝滚动</title>
<style type="text/css">
.sqBorder {width:300px; height:300px; padding:0px; background:#666666; overflow:hidden; border:solid 1px red; background:yellow;}
.scroll_div {width:300px; height:300px; overflow: hidden; background:yellow;} /* white-space: nowrap; 竖向不是滚动的重要条件*/
</style>
</head>
<body>
<div class="sqBorder">
<div id="scroll_div" class="scroll_div">
<div id="scroll_begin">
<h4>start...</h4>
<h4>无缝滚动测试代码</h4><h4>无缝滚动测试代码</h4><h4>无缝滚动测试代码</h4><h4>无缝滚动测试代码</h4><h4>无缝滚动测试代码</h4><h4>无缝滚动测试代码</h4><h4>end...</h4>
</div>
<div id="scroll_end"></div>
</div>
</div>
<script type="text/javascript">
function ScrollImgTop(speed,div,s_begin,s_end){
var divObj = document.getElementById(div);
var beginObj = document.getElementById(s_begin);
var endObj = document.getElementById(s_end);
endObj.innerHTML=beginObj.innerHTML;
function Marquee(){
if(endObj.offsetHeight-divObj.scrollTop<=0){
divObj.scrollTop=0; // 由于下面else设置为+=1,所以这里直接设置为0即可。
}
else{
divObj.scrollTop+=1;
}
}
var