标题:js 在火狐和ie的兼容性问题
只看楼主
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
结帖率:91.67%
 问题点数:0 回复次数:1 
js 在火狐和ie的兼容性问题
我都把marquees 改为 document.getElementById("marquees") templayer改为 document.getElementById("templayer")为什么还是在ie能浏览在火狐上就不行了呢
<table width="214" border="0" cellpadding="0" cellspacing="0" background="img/lefttitle1.jpg" >
        <tr>
          <td height="30" class="lefttd"><div style="margin-left:40px;">都市114</div></td>
        </tr>
      </table>
      <table width="214" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="128" background="img/lefttitle1bg.jpg" valign="top"><div id="marquees">
        <%set rs1=server.createobject("adodb.recordset")
sql="select top 7 * from tbl_dushi114 order by id desc"
rs1.open sql,conn,1,1
do while not rs1.eof
%>
        <div id="articleline"><div id="titlebox1"><%=rs1("114name")%>:<%=rs1("114tel")%></div></div>
        <%
rs1.movenext
loop
%>
        <%
rs1=close
set rs1=nothing
%>
      </div>
<script language="javascript">
marqueesHeight=170; //内容区高度
stopscroll=false; //这个变量控制是否停止滚动
with(document.getElementById("marquees")){
noWrap=true; //这句表内容区不自动换行
style.width=0; //于是我们可以将它的宽度设为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(){
  document.getElementById("templayer").innerHTML="";
  while(document.getElementById("templayer").offsetHeight<marqueesHeight){
    document.getElementById("templayer").innerHTML+=document.getElementById("marquees").innerHTML;
  }
 document.getElementById("marquees").innerHTML=document.getElementById("templayer").innerHTML+document.getElementById("templayer").innerHTML;
  setInterval("scrollUp()",50);
}
document.body.onload=init;

function scrollUp(){
  if(stopscroll==true) return;
  preTop=document.getElementById("marquees").scrollTop;
  document.getElementById("marquees").scrollTop+=1;
  if(preTop==document.getElementById("marquees").scrollTop){
    document.getElementById("marquees").scrollTop=document.getElementById("templayer").offsetHeight-marqueesHeight;
    document.getElementById("marquees").scrollTop+=1;
  }
}

</script>

</td>
        </tr>
        <tr>
          <td height="15" background="img/lefttitle1bg.jpg"><img src="img/lefttitle1bottom.jpg" width="214" height="15"></td>
        </tr>
      </table>
搜索更多相关主题的帖子: style 兼容性 
2011-04-21 11:41
ab382717036
Rank: 2
等 级:论坛游民
帖 子:73
专家分:20
注 册:2011-3-19
得分:0 
求助
2011-04-23 08:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-337423-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.188220 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved