您现在的位置是:首页 > 电脑技术查询 > web开发

this.oDiv.children.length在ff下该如何写

编辑:chaxungu时间:2022-10-02 23:22:13分类:web开发

this.oDiv.children.length在ff下该怎么写
ie下能正常

------解决方案--------------------
<table>
<tr id= "oDiv " name= "oDiv "> <td> </td> <td> </td> </tr>
</table>
<script>
//alert(this.oDiv);
//this.oDiv--> undefined in firefox
alert(document.all?this.oDiv.children.length:document.getElementById( "oDiv ").childNodes.length);
</script>