关于滚动的代码
<div id=marquees style= "height=100px;LEFT: 60px; POSITION: absolute; TOP: 100px; "> <font style= "font-family:宋体; color:white; font-size:14px;line-height=15px ">
<a href= "# "> 你在做什么 </a> <br>
<br>
<a href= "# "> 我在仰望天空 </a> <br>
<br>
<a href= "# "> 30度仰望是什么 </a> <br>
<a href= "# "> 为了不让我的眼泪掉下来 </a> <br>
<br>
<br>
<br>
</div>
<script language= "JavaScript ">
marqueesHeight=100;
stopscroll=false;
with(marquees){
style.width=0;
style.height=marqueesHeight;
style.overflowX= "visible ";
style.overflowY= "hidden ";
noWrap=true;
onmouseover=new Function( "stopscroll=true ");
onmouseout=new Function( "stopscroll=false ");
}
document.write( ' <div id= "templayer " style= "position:absolute;z-index:1;visibility:hidden "> </div> ');
preTop=0; currentTop=0;
function init(){
templayer.innerHTML= " ";
while(templayer.offsetHeight <marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval( "scrollup() ",30);
}
document.body.onload=init;
function scrollup(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>
请问下这个滚动代码为什么不能重用,就是在一个页面显示2个以上的滚动,哪位高手知道的帮解决下好吗?谢谢
------解决方案--------------------http://community.csdn.net/Expert/topic/5430/5430501.xml?temp=.1596949
------解决方案--------------------id重复导致冲突
------解决方案--------------------templayer.innerHTML= " "; ' 'templayer是名称,把它改为别或者用参数来替代它,就可以使用了