当前位置: 首页 > 图文教程 > 网页制作 > HTML/XHTML教程 > 连续滚动的超级链接文字网页代码

HTML/XHTML教程
标记语言:为
将XHTML CSS页面转换为打印机页面
robots.txt详细介绍
HTML和CSS在Flash中的应用
html sub标记和sup标记
HTML 超级链接详细讲解
网页制作前先来看看这些所谓的规范
HTML iframe 用法总结收藏
HTML5 Canvas 起步(2) - 路径
XHTML1.0与HTML兼容指引16条 小结
有效网页表单的八条规则
html pre标记里内容自动换行
设计师 需要学习编写代码吗
使用整洁的HTML标记构建页面
img usemap属性 中国地图链接
HTML5 Canvas标签使用收录
HTML&CSS&JS兼容树(IE,Firefox,chrome)
用js互相调用iframe页面内的js函数
网页制作基础 声明文档类型描述(DTD
HTML5 CSS3新的WEB标准和浏览器支持

HTML/XHTML教程 中的 连续滚动的超级链接文字网页代码


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 128 ::
收藏到网摘: n/a

向上滚动

<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=”hidden”;
style.overflowY=”visible”;
noWrap=true;
onmouseover=new Function(”stopscroll=true”);
onmouseout=new Function(”stopscroll=false”);
}
preLeft=0; currentLeft=0; stopscroll=false;

function init(){
templayer.innerHTML=””;
while(templayer.offsetWidth<marqueesWidth){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML+=templayer.innerHTML;
setInterval(”scrollLeft()”,10);
}init();

function scrollLeft(){
if(stopscroll==true) return;
preLeft=marquees.scrollLeft;
marquees.scrollLeft+=1;
if(preLeft==marquees.scrollLeft){
marquees.scrollLeft=templayer.offsetWidth-marqueesWidth+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=”hidden”;
style.overflowY=”visible”;
noWrap=true;
onmouseover=new Function(”stopscroll=true”);
onmouseout=new Function(”stopscroll=false”);
}
preTop=0; currentTop=0; getlimit=0; stopscroll=false;

function init(){
templayer.innerHTML=””;
while(templayer.offsetWidth<marqueesWidth){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML+=templayer.innerHTML;
setInterval(”scrollRight()”,10);
}init();

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

preLeft=marquees.scrollLeft;
marquees.scrollLeft-=1;
if(preLeft==marquees.scrollLeft){
if(!getlimit){
marquees.scrollLeft=templayer.offsetWidth*2;
getlimit=marquees.scrollLeft;
}
marquees.scrollLeft=getlimit-templayer.offsetWidth+marqueesWidth;
marquees.scrollLeft-=1;
}
}
</script>