网站制作学习网JS脚本→正文:水平无缝滚动
字体:

水平无缝滚动

JS脚本 2009/11/7 22:17:56  点击:不统计

来源于网路,www.forasp.cn 网站制作学习网整理,实现水平无缝滚动,主要是广告或者是友情链接显示

查看效果: 水平无缝滚动
<style type="text/css">
<!--
#demo {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 600px;
}
#demo img {
border: 3px solid #F2F2F2;
}
#indemo {
float: left;
width: 800%;
}
#demo1 {
float: left;
}
#demo2 {
float: left;
}
-->
</style>
<table width="90%" border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td width="12%" height="126" align="right">企业图片:</td>
    <td width="88%" align="left"><table width="121" height="126" border="0" cellpadding="0" cellspacing="0"><tr><td>
<div id="demo">
<div id="indemo">
<div id="demo1">
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
<a href="http://www.forasp.cn/"><img src="http://www.forasp.cn/images/logo2.gif" border="0" /></a>
</div>
<div id="demo2"></div>
</div>
</div></td>
</tr></table></td>
</tr>
</table>
</script>
<!--
var speed=10; //数字越大速度越慢
var tab=document.getElementById("demo");
var tab1=document.getElementById("demo1");
var tab2=document.getElementById("demo2");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft<=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
-->
</script>

·上一篇:js点击qq直接聊天 >>    ·下一篇:预载入图象 >>
推荐文章
最新文章