FIREFOX下的连续滚动字幕问题 我把你给我参考的那段代码全部存成一个新的HTM文件,然后在FIREFOX中打开,根本就不滚动。所以我也就没仔细再往下看。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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=gb2312" /><style type="text/css"><!--body,td,th { font-size: 12px;}--></style></head><body><div id="demo" style="overflow:hidden; width:300px; height:132px; line-height:20px;"> <div id="demo1"> 11111111<br>11111111<br>11111111<br>11111111<br>11111111<br>11111111<br>11111111</div> <div id="demo2"></div> </div> <script language="javascript"> var speed=30 document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML function Marquee(){ if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0) document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight else{ document.getElementById("demo").scrollTop++ } document.getElementById("a").innerHTML=document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop;} var MyMar=setInterval(Marquee,speed) document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)} document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)} </script> <div id="a"></div></body></body></html>你自己看就知道了 你复制我的代码测试以后你再把<div id="demo1"> 11111111<br>11111111<br>11111111<br>11111111<br>11111111<br>11111111<br>11111111</div> 这里,面的最后一行11111111删掉,你对比一下,然后仔细观察<div id="a"></div>这个的值的变化就知道了 在FIREFOX下,a的值,到了489就停止了 <!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=gbk" /><title>test</title><style>body {font: 12px, Arial, Helvetica, sans-serif;color: #808080;}a:visited, a:link {color: #808080; text-decoration: none;}a:hover {color: #2359B1;}#wrapper { margin:0 auto;width:960px; background-color:#FFF; height:auto; overflow: hidden;}#content{ width:960px; height:auto; overflow:hidden; clear:both;margin-top:10px;}#side{ FLOAT: left; OVERFLOW: hidden; WIDTH: 215px; HEIGHT: auto; BACKGROUND-COLOR: #fafafa}.cartbox{width:189px; border:5px solid #cccccc; margin-bottom:5px; margin-top:0px; line-height:25px; padding:8px;}.invoicequery{border: 1px solid #A5E26B; width:213px; margin-bottom:5px;}.invoicequery .title{ background:url(images/menu_bg.gif); height:27px;font-size:14px; font-weight:bold; line-height:25px; padding-left:10px; padding-top:6px;}.invoicequery .content{width:203px;border-top:1px dashed #DADADA; margin-left:5px; padding-top:5px; margin-bottom:0px; padding-bottom:5px;}.invoicequery .content .invoicebox ul{ height:18px; width:189px; margin:0px; margin-left:6px; padding-left:0px; padding-top:0px!important; padding-top:2px; padding-bottom:2px; background: #F7F7F7}.invoicequery .content .invoicebox .odb{border:1px dashed #DADADA;border-bottom:none}.invoicequery .content .invoicebox .ivb{border:1px dashed #DADADA; margin-bottom:5px;}.invoicequery .content .invoicebox li{ line-height:16px; list-style-type:none; float:left;}.invoicequery .content .invoicebox .tt{ width:60px; padding-left:6px; padding-top:2px!important; padding-top:3px;}#demo{overflow:hidden; height:148px!important; height:160px;}</style></head><body><div id="wrapper"><div id="content"><div id="side"><div class="cartbox"><a href="../shop/mycart.php" title="查看购物车">您的购物车中有 0 件商品,总计金额 ¥0.00元。</a></div><div class="invoicequery"> <div class="title">发货单号查询</div><div class="content"><div class="invoicebox"><div id="demo"> <div id="demo1"><ul class="odb"><li class="tt">订货单号</li><li>2008100672310</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>34324323434</li></ul><ul class="odb"><li class="tt">订货单号</li><li>2008100609437</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>frrrt</li></ul><ul class="odb"><li class="tt">订货单号</li><li>2008100643652</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>3432432343</li></ul><ul class="odb"><li class="tt">订货单号</li><li>2008100629784</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>3431112</li></ul><ul class="odb"><li class="tt">订货单号</li><li>2008100666583</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>3333333333</li></ul><ul class="odb"><li class="tt">订货单号</li><li>2008092583610</li></ul><ul class="ivb"><li class="tt">发货单号</li><li>333333</li></ul></div> <div id="demo2"></div> </div></div><script> var speed=50 document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML function Marquee(){ if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0) document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight else{ document.getElementById("demo").scrollTop++ } } var MyMar=setInterval(Marquee,speed) document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)} document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}</script></div></div></div></div></div></body></html>这是我的代码,在FIREFOX下,每循环滚动2次就停止了。但如果直接把ID为invoicequery直接放在BODY里,就不会停止了。帮我看看问题出在哪里? 还是你这个的问题#demo{overflow:hidden; height:148px!important; height:160px;}你的JS只要改成:<script> var speed=50 document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML function Marquee(){ if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0) document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight else{ document.getElementById("demo").scrollTop++ } document.getElementById("a").innerHTML=document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop;} var MyMar=setInterval(Marquee,speed) document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)} document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}</script>然后再加一个<div id="a"></div>你就发现,FF下a的值无法达到0,所以就停止了 如果我用上面我发的代码,我把#demo{overflow:hidden; height:148px!important; height:160px;} 改成height:144px!important的话,这时候A的值可以到0,而且循环也正常。但是如果我在SIDE里增加其他内容的话,A的值就又会停在一个指定的数字上。那就是说没办法了? 内容的高度和那个高度的统一DIV在IE和FF下的offsetTop值是不一样的 #demo{overflow:hidden; height:160px;POSITION: absolute;}就可以了 Ext的comboBox用json格式的数据来填充 如何点击IE右键某一添加项,调用远程的js? 关于未成年年龄的前台验证 input file问题 一个验证邮箱的js函数 清空页面中的表单内容 求一正则表达式,谢谢 在一段学习代码中onSubmit="return checkForm24(this);"为什么没有正确执行? c#使用jqgrid的编辑、增加、删除功能完成后客户端如和判断服务器端处理是否成功 图片的问题 高手帮忙,新手求救,求一个js代码。 类似gmail上传附件的,添加一个附件。。。再添加一个附件 请教大家怎么写的用javascript写邮箱验证(50分)
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">
<!--
body,td,th {
font-size: 12px;
}
-->
</style></head>
<body>
<div id="demo" style="overflow:hidden; width:300px; height:132px; line-height:20px;">
<div id="demo1">
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111
</div>
<div id="demo2"></div>
</div>
<script language="javascript">
var speed=30
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){ if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0)
document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight
else{
document.getElementById("demo").scrollTop++
}
document.getElementById("a").innerHTML=document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop;
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
<div id="a"></div>
</body>
</body>
</html>
你自己看就知道了
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111<br>
11111111
</div>
这里,面的最后一行11111111删掉,你对比一下,然后仔细观察<div id="a"></div>
这个的值的变化就知道了
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<title>test</title>
<style>
body {font: 12px, Arial, Helvetica, sans-serif;color: #808080;}
a:visited, a:link {color: #808080; text-decoration: none;}
a:hover {color: #2359B1;}
#wrapper { margin:0 auto;width:960px; background-color:#FFF; height:auto; overflow: hidden;}
#content{ width:960px; height:auto; overflow:hidden; clear:both;margin-top:10px;}
#side{ FLOAT: left; OVERFLOW: hidden; WIDTH: 215px; HEIGHT: auto; BACKGROUND-COLOR: #fafafa}
.cartbox{width:189px; border:5px solid #cccccc; margin-bottom:5px; margin-top:0px; line-height:25px; padding:8px;}
.invoicequery{border: 1px solid #A5E26B; width:213px; margin-bottom:5px;}
.invoicequery .title{ background:url(images/menu_bg.gif); height:27px;font-size:14px; font-weight:bold; line-height:25px; padding-left:10px; padding-top:6px;}
.invoicequery .content{width:203px;border-top:1px dashed #DADADA; margin-left:5px; padding-top:5px; margin-bottom:0px; padding-bottom:5px;}
.invoicequery .content .invoicebox ul{ height:18px; width:189px; margin:0px; margin-left:6px; padding-left:0px; padding-top:0px!important; padding-top:2px; padding-bottom:2px; background: #F7F7F7}
.invoicequery .content .invoicebox .odb{border:1px dashed #DADADA;border-bottom:none}
.invoicequery .content .invoicebox .ivb{border:1px dashed #DADADA; margin-bottom:5px;}
.invoicequery .content .invoicebox li{ line-height:16px; list-style-type:none; float:left;}
.invoicequery .content .invoicebox .tt{ width:60px; padding-left:6px; padding-top:2px!important; padding-top:3px;}
#demo{overflow:hidden; height:148px!important; height:160px;}
</style>
</head>
<body>
<div id="wrapper">
<div id="content">
<div id="side">
<div class="cartbox"><a href="../shop/mycart.php" title="查看购物车">您的购物车中有 0 件商品,总计金额 ¥0.00元。</a></div>
<div class="invoicequery">
<div class="title">发货单号查询</div>
<div class="content">
<div class="invoicebox">
<div id="demo">
<div id="demo1">
<ul class="odb"><li class="tt">订货单号</li><li>2008100672310</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>34324323434</li></ul>
<ul class="odb"><li class="tt">订货单号</li><li>2008100609437</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>frrrt</li></ul>
<ul class="odb"><li class="tt">订货单号</li><li>2008100643652</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>3432432343</li></ul>
<ul class="odb"><li class="tt">订货单号</li><li>2008100629784</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>3431112</li></ul>
<ul class="odb"><li class="tt">订货单号</li><li>2008100666583</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>3333333333</li></ul>
<ul class="odb"><li class="tt">订货单号</li><li>2008092583610</li></ul>
<ul class="ivb"><li class="tt">发货单号</li><li>333333</li></ul>
</div>
<div id="demo2"></div>
</div>
</div>
<script>
var speed=50
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){
if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0)
document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight
else{
document.getElementById("demo").scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>
</div>
</div>
</div>
</div>
</div>
</body>
</html>这是我的代码,在FIREFOX下,每循环滚动2次就停止了。
但如果直接把ID为invoicequery直接放在BODY里,就不会停止了。
帮我看看问题出在哪里?
你的JS只要改成:<script>
var speed=50
document.getElementById("demo2").innerHTML=document.getElementById("demo1").innerHTML
function Marquee(){
if(document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop<=0)
document.getElementById("demo").scrollTop-=document.getElementById("demo1").offsetHeight
else{
document.getElementById("demo").scrollTop++
}
document.getElementById("a").innerHTML=document.getElementById("demo2").offsetTop-document.getElementById("demo").scrollTop;
}
var MyMar=setInterval(Marquee,speed)
document.getElementById("demo").onmouseover=function() {clearInterval(MyMar)}
document.getElementById("demo").onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</script>然后再加一个<div id="a"></div>你就发现,FF下a的值无法达到0,所以就停止了
DIV在IE和FF下的offsetTop值是不一样的
就可以了