<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>左右无间断滚动</title>
<style type="text/css" media="all">
.d1 {
 margin:10px auto;
 width:200px;
 background-color:#EFEFEF;
 height:auto;
 overflow:hidden;
 white-space:nowrap;
}
.d2 {
 margin:0px auto;
 background-color:#FF9933;
}
.div2 {
 width:auto;
 height:auto;
 font-size:12px;
 float:left;
 overflow:hidden;
}
ul {
 margin:0px;
 padding:9px 0px;
 list-style:none;
 line-height:19px;
 font-size:12px;
}
li{
float:left;
line-height:22px;
margin:0px 6px;
text-align:center;
padding:0px;
border:#103E63 1px solid;
}
a:link, a:visited {
 color:#3F78CF;
 text-decoration:none;
}
a:hover {
 color:#FF00CC;
 text-decoration:underline;
}
</style>
<script language="javascript" type="text/javascript">
var s,s2,s3,s4,timer;
function init(){
s=getid("div1");
s2=getid("div2");
s3=getid("div3");
s4=getid("scroll");
s4.style.width=(s2.offsetWidth*12+100)+"px";
s3.innerHTML=s2.innerHTML;
timer=setInterval(mar,30)
}
function mar(){
if(s2.offsetWidth<=s.scrollLeft){
s.scrollLeft-=s2.offsetWidth;
}else{s.scrollLeft++;}
}
function getid(id){
return document.getElementById(id);
}
window.onload=init;
</script>
</head>
<body>
<div class="d1" ></div>
  </div>
</div>
</body>
</html>

相关文章:

  • 2021-10-02
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-07-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-06-19
  • 2021-10-07
  • 2021-12-06
  • 2021-12-13
相关资源
相似解决方案