firefox中getElementById问题

来源:百度知道 编辑:UC知道 时间:2024/09/25 08:30:01
代码:
for(i=1;i<=display_outputContent_divs.length;i++){
if(i==id){
document.getElementById("outputContent_channel"+i).style.display="block";
document.getElementById("chatPeople_channel"+i).style.display="block";
}
else{
document.getElementById("outputContent_channel"+i).style.display="none";
document.getElementById("chatPeople_channel"+i).style.display="none";
}
}
问题说明:IE显示正常
firefox报错,错误提示:document.getElementById("outputContent_channel" + i) has no properties
没看明白,能说的具体点么,正确的应该怎么写呢?

oElement = document . getElementById ( sID )
参数: sID : 必选项。字符串 (String)
返回值: oElement : 对象 (Element) 。
说明: 根据指定的 id 属性值得到对象。返回 id 属性值等于 sID 的第一个对象的引用。假如对应的为一组对象,则返回该组对象中的第一个。

sID参数严格应该是文本型/