下面这段代码可以实现间段性的滚动..但是没有很平滑的那种滚动效果..会有抖动的感觉..哪位大侠可以帮忙改一下?实现马上送一百分!<!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>
<script>
function startmarquee(lh,speed,delay,index){
var t;
var p=false;
var o=document.getElementById("marqueebox"+index);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling()
{
if(o.scrollTop%lh!=0)
{
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}
else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
</script>
</head>
<body>
<DIV style="LINE-HEIGHT: 22px; HEIGHT: 87px; FONT-SIZE: 12px; OVERFLOW: hidden" id=marqueebox0>
<!--line-height:文字行距-->
<A href="#" target=_blank><FONT color=#ff0000>谨防假冒惠州人才网</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>警示:个人求职者请勿交纳押金!!</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州全景地图正式推出</FONT></A><BR>
<A href="#" target=_blank>惠州裕泰五金塑胶制品有限公司诚聘</A><BR>
<A href="#" target=_blank>东莞祐康食品有限公司惠州办事处</A><BR>
<A href="#" target=_blank>加入我们的正式企业会员,有好礼送!</A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州人才网招聘销售客服</FONT></A><BR>
<A href="#" target=_blank>大亚湾中海酒店诚聘精英</A><BR>
<A href="#" target=_blank>惠州百图丽实业有限公司</A><BR>
</DIV>
<SCRIPT>
startmarquee(44,100,1000,0);
/**startmarquee(一次滚动高度,速度,停留时间,图层标记);**/
</SCRIPT>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>间歇性无缝滚动代码实例</title>
<script>
function startmarquee(lh,speed,delay,index){
var t;
var p=false;
var o=document.getElementById("marqueebox"+index);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling()
{
if(o.scrollTop%lh!=0)
{
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}
else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
</script>
</head>
<body>
<DIV style="LINE-HEIGHT: 22px; HEIGHT: 87px; FONT-SIZE: 12px; OVERFLOW: hidden" id=marqueebox0>
<!--line-height:文字行距-->
<A href="#" target=_blank><FONT color=#ff0000>谨防假冒惠州人才网</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>警示:个人求职者请勿交纳押金!!</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州全景地图正式推出</FONT></A><BR>
<A href="#" target=_blank>惠州裕泰五金塑胶制品有限公司诚聘</A><BR>
<A href="#" target=_blank>东莞祐康食品有限公司惠州办事处</A><BR>
<A href="#" target=_blank>加入我们的正式企业会员,有好礼送!</A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州人才网招聘销售客服</FONT></A><BR>
<A href="#" target=_blank>大亚湾中海酒店诚聘精英</A><BR>
<A href="#" target=_blank>惠州百图丽实业有限公司</A><BR>
</DIV>
<SCRIPT>
startmarquee(44,100,1000,0);
/**startmarquee(一次滚动高度,速度,停留时间,图层标记);**/
</SCRIPT>
</body>
</html>
如果让它滚动的时候没有那种抖动的感觉..
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>间歇性无缝滚动代码实例</title>
<script>
function startmarquee(lh,speed,delay,index){
var t;
var p=false;
var o=document.getElementById("marqueebox"+index);
o.innerHTML+=o.innerHTML;
o.onmouseover=function(){p=true}
o.onmouseout=function(){p=false}
o.scrollTop = 0;
function start(){
t=setInterval(scrolling,speed);
if(!p) o.scrollTop += 2;
}
function scrolling()
{
if(o.scrollTop%lh!=0)
{
o.scrollTop += 2;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}
else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
</script>
</head>
<body>
<DIV style="LINE-HEIGHT: 22px; HEIGHT: 87px; FONT-SIZE: 12px; OVERFLOW: hidden" id=marqueebox0>
<!--line-height:文字行距-->
<A href="#" target=_blank><FONT color=#ff0000>谨防假冒惠州人才网</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>警示:个人求职者请勿交纳押金!!</FONT></A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州全景地图正式推出</FONT></A><BR>
<A href="#" target=_blank>惠州裕泰五金塑胶制品有限公司诚聘</A><BR>
<A href="#" target=_blank>东莞祐康食品有限公司惠州办事处</A><BR>
<A href="#" target=_blank>加入我们的正式企业会员,有好礼送!</A><BR>
<A href="#" target=_blank><FONT color=#ff0000>惠州人才网招聘销售客服</FONT></A><BR>
<A href="#" target=_blank>大亚湾中海酒店诚聘精英</A><BR>
<A href="#" target=_blank>惠州百图丽实业有限公司</A><BR>
</DIV>
<SCRIPT>
startmarquee(44,20,2000,0);
/**startmarquee(一次滚动高度,速度,停留时间,图层标记);**/
</SCRIPT>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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">
<!--
a{
color:#666666; text-decoration:none; display:block; line-height:1.5em;
}
a:hover{
color:#cc0000; text-decoration:none;
}
body{
font:12px 宋体, Verdana, Arial, Helvetica, sans-serif;
background:#ffffff;
margin:0;
padding:0;
text-align:center;
color:#000000;
}
div.div_header{
width:243px; height:16px; vertical-align:top; text-align:left; font-size:14px; padding:6px;
}
div.div_top_root{
width:255px;
height:134px;
background:url(../images/logo_bckg.jpg);
background-repeat:no-repeat;
}
#scrollContainer{
margin-left:10pt;
margin-top:2pt;
overflow:hidden;
text-align:left;
}
-->
</style>
</head><body>
<div class="div_top_root">
<div class="div_header">今日新闻</div>
<div id="scrollContainer">
<div id="scrollContent">
<a href=""> 第1条</a>
<a href=""> 第2条</a>
<a href=""> 第3条</a>
<a href=""> 第4条</a>
<a href=""> 第5条</a>
<a href=""> 第6条</a>
<a href=""> 第7条</a>
<a href=""> 第8条</a>
<a href=""> 第9条</a>
<a href=""> 第10条</a>
<a href=""> 第11条</a>
<a href=""> 第12条</a>
<a href=""> 第13条</a>
<a href=""> 第14条</a>
</div>
</div>
</div>
<script type="text/javascript" language="javascript">
<!--
var stopscroll = false;
var scrollContHeight= 95;
var scrollContWidth= 230;
var scrollSpeed = 25;
//获取scrollContainer
var scrollContainer = document.getElementById("scrollContainer");
//获取scrollContent
var scrollContent = document.getElementById("scrollContent");
do
{
scrollContainer.appendChild(scrollContent.cloneNode(true));
}while(scrollContainer.offsetHeight < scrollContHeight);
scrollContainer.style.width = scrollContWidth + "px";
scrollContainer.style.height = scrollContHeight + "px";
scrollContainer.noWrap = true;
scrollContainer.onmouseover = new Function("stopscroll=true;");
scrollContainer.onmouseout = new Function("stopscroll=false");
function init()
{
scrollContainer.scrollTop = 0;
setInterval("scrollUp()",scrollSpeed);
}
init();
function scrollUp()
{
if(stopscroll == true) return;
currTop = scrollContainer.scrollTop;
scrollContainer.scrollTop += 1;
if(currTop == scrollContainer.scrollTop)
{
scrollContainer.scrollTop = 0;
scrollContainer.scrollTop += 1;
}
}
-->
</script>
两位.o.scrollTop += 1; 这句加在什么地方?其实就像是七楼的兄弟那种没有抖动的效果.只不过他的是一直在滚动..不是我想要的那种一屏滚动多少那个?