<html>
<head>
<style type="text/css">
#top{width:900px;overflow:hidden;}
#con{height:340px;width:900px;width:2700px;}
#con div.demo{width:900px;height:340px;background:#ff99ff;float:left;}
</style>
</head>
<body>
<div id="top">
<div id="con" style="margin-left:0;">
<div class="demo" style="width:900px;"><p>testetestststs</p></div>
<div class="demo" style="width:900px;"><p>setestsetsetsetest</p></div>
<div class="demo" style="width:900px;"><p>testsettsetsetsets</p></div>
</div>
</div>
<script type="text/javascript">
var $=function(ID){return document.getElementById(ID);}
var speed=25;
function scroll(){
if(Math.abs(parseInt($("con").style.marginLeft))>=parseInt($("con").childNodes[0].style.width)){
$("con").appendChild($("con").childNodes[0]);
$("con").style.marginLeft="0px";
clearTimeout(time);
setTimeout(function(){time=setTimeout(scroll,speed);},2000);
} else {
$("con").style.marginLeft=(parseInt($("con").style.marginLeft)-40)+"px";
time=setTimeout(scroll,speed);
}
}
var time=setTimeout(scroll,speed);
</script>
</body>
</html>
貌似在chrome中无法运行~
求解..
解决方案 »
- html中的地图
- 根据用户input内容决定的span
- 这个正则比配什么啊 ??/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/
- 利用select的值的改变,改变input的值,input的值是通过select传来的值并在数据库里找的
- 这段代码为什么不能执行?
- 能不能禁止当前页面的后退功能?
- 关于dojo,新手询问
- 设置了一个有borderColor属性的CSS样式,如何根据ClassName获取这个属性值??
- [高手帮忙] 这个网页该怎样修改才能正常运行
- 请问这个错误是什么原因啊?
- 我已经找到一个JQUERY对象,怎么用after方法将其插入到另一个元素的最后面
- 关闭浏览器就提交表单(javascript)
var $=function(ID){return document.getElementById(ID);}
var speed=25;
function scroll(){
if(Math.abs(parseInt($("con").style.marginLeft))>=parseInt($("con").getElementsByTagName("div")[0].style.width)){
$("con").appendChild($("con").getElementsByTagName("div")[0]);
$("con").style.marginLeft="0px";
clearTimeout(time);
setTimeout(function(){time=setTimeout(scroll,speed);},2000);
} else {
$("con").style.marginLeft=(parseInt($("con").style.marginLeft)-40)+"px";
time=setTimeout(scroll,speed);
}
}
var time=setTimeout(scroll,speed);
修改了下js,貌似chrome中可以正常运行~求批....
感觉做的复杂了