52. Element item() 方法
来源:互联网 发布:视频剪辑软件中文 编辑:程序博客网 时间:2024/06/03 14:36
实例
返回元素的首个子节点:
document.body.childNodes.item(0);
<body><p id="demo">点击按钮来获得 body 元素首个子节点的名称。</p><button onclick="myFunction()">试一下</button><script>function myFunction(){var x=document.getElementById("demo"); x.innerHTML=document.body.childNodes.item(0).nodeName;}</script></body>
定义和用法
item() 方法节点列表中位于指定索引的节点。
以下两条语法产生相同的结果:
document.body.childNodes.item(0);document.body.childNodes[0]
0 0
- 52. Element item() 方法
- QML Item Element
- DOM Element 常用方法
- 37. Element appendChild() 方法
- 38. Element cloneNode() 方法
- 39. Element compareDocumentPosition() 方法
- 40. Element getAttribute() 方法
- 41. Element getElementsByTagName() 方法
- 42. Element hasChildNodes() 方法
- 43. Element hasAttributes() 方法
- 44. Element insertBefore() 方法
- 45. Element isDefaultNamespace() 方法
- 46. Element isEqualNode() 方法
- 47. Element isSameNode() 方法
- 48. Element isSupported() 方法
- 49. Element removeAttribute() 方法
- 50. Element removeChild() 方法
- 51. Element replaceChild() 方法
- 伤敌一千,自损八百
- 9.6智力题(二)——九球称重
- hadoop序列化机制与java序列化机制对比
- 【Lua】coroutine
- 右侧跟随滚动框(调用框架)
- 52. Element item() 方法
- 使用TextView/EditText应该注意的地方
- Apache的access.log分析
- 关于c#.net oracle 中联系执行多条sql语句的问题
- hi3516a之查看相关输入信息
- IIS500的问题
- 如何修改报表平台中数据决策系统登陆地址
- 如何导出图片到EXCEL中
- 53. Element setAttribute() 方法