【引用】js中firefox,ie兼容
??? cell = row.insertCell(0);
??? cell.appendChild(chkbox);
??? row.appendChild(cell);
?cc. 兼容写法:
????var chkbox= document.createElement("td");
??? chkbox.innerHTML = "<input type='checkbox' name='checkbox_index' value='" + rowsLen + "'/>";
??? cell = row.insertCell(0);
??? cell.appendChild(chkbox);
??? row.appendChild(cell);?
2.动态修改表格本内容
?? tbl.rows[row_index].cells(1).innerHTML = acl_protocol;??? // ie支持,firefox不支持
?? tbl.rows[row_index].cells[1].innerHTML = acl_protocol;??? // ie,firefox兼容
3. ie支持直接通过id找到元素,firefox必须通过document.getElementById(idName)找到元素。
4. 当同名checkbox只有一个的时候,在firefox中document.getElementById(checkbox_name).length=undifined.在IE中测试时,document.getElementById(checkbox_name).length有时为1,有时为undifined,不知是什么原因。
5.在IE中经常定义var $ = document.getElementById,后面就用$代替document.getElementById,如var temp = $("test");。我在firefox中使用这种方法提示错误,后来将var temp = $("test")改为var temp = document.getElementById("test"),运行正常。