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>