日期:2014-01-15  浏览次数:20704 次

网页制造aiyiweb文章简介:连续滚动的链接文字网页代码.

向上滚动

<div id=”marquees”>
<a href=”#”>爱易网任务室一</a><br>
<br>
<a href=”#”>爱易网任务室二</a><br>
<br>
<a href=”#”>爱易网任务室三</a><br>
<br>
<a href=”#”>爱易网任务室四</a>
<br>
</div>
<script language=”JavaScript”>

marqueesHeight=200;
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()”,10);
}
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>

向下滚动

<div id=”marquees”> <a href=”#”>爱易网任务室一</a><br>
<br>
<a href=”#”>爱易网任务室二</a><br>
<br>
<a href=”#”>爱易网任务室三</a><br>
<br>
<a href=”#”>爱易网任务室四</a><br>
<br>
</div>
<script language=”JavaScript”>

marqueesHeight=200;

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;getlimit=0;stopscroll=false;

function init(){
templayer.innerHTML=””;
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML+=templayer.innerHTML;
setInterval(”scrollDown()”,10);
}init();

function scrollDown(){
if(stopscroll==true) return;

preTop=marquees.scrollTop;
marquees.scrollTop-=1;
if(preTop==marquees.scrollTop){
if(!getlimit){
marquees.scrollTop=templayer.offsetHeight*2;
getlimit=marquees.scrollTop;
}
marquees.scrollTop=getlimit-templayer.offsetHeight+marqueesHeight;
marquees.scrollTop-=1;
}
}
</script>

向左滚动

<div id=”marquees”>
<a href=”#”>爱易网任务室一</a>
<a href=”#”>爱易网任务室二</a>
<a href=”#”>爱易网任务室三</a>
<a href=”#”>爱易网任务室四</a>
</div>

<div id=”templayer” style=”position:absolute;left:0;top:0;visibility:hidden”></div>
<script language=”JavaScript”>

marqueesWidth=200;

with(marquees){
style.height=0;
style.width=marqueesWidth;
style.overflowX=”h