dreamweaver中如何实现通知栏滚动
2个回答
展开全部
<div id="marqueebox0">
<ul>
<li><a href="#">weisuiyu</a></li>
<li><a href="#">ajshdjkahdkahdkah</a></li>
<li><a href="#">ajghjgjjgjukkh</a></li>
<li><a href="#">ajshsdfsdfsdf</a></li>
</ul></div>
<script type="text/javascript">
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 += 1;}
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 1;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
startmarquee(25,30,2000,0);
</script>
这样就好了
<ul>
<li><a href="#">weisuiyu</a></li>
<li><a href="#">ajshdjkahdkahdkah</a></li>
<li><a href="#">ajghjgjjgjukkh</a></li>
<li><a href="#">ajshsdfsdfsdf</a></li>
</ul></div>
<script type="text/javascript">
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 += 1;}
}
function scrolling(){
if(o.scrollTop%lh!=0){
o.scrollTop += 1;
if(o.scrollTop>=o.scrollHeight/2) o.scrollTop = 0;
}else{
clearInterval(t);
setTimeout(start,delay);
}
}
setTimeout(start,delay);
}
startmarquee(25,30,2000,0);
</script>
这样就好了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询