无标题文档
//常用的获取节点 操作节点方法
用getElementsByTagName取得的节点对象可以绑定事件 如
ht[0].onclick = function(){};
用用childnodes, 取得的节点 不能绑定事件?仅仅能获取到节点名而已?其他啥也不能做?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
console.log(document.firstChild)看看是啥你就知道了。Node是一个接口,从文档的结构角度来看的;
Document, Element, CharacterData, ProcessingInstruction, DocumentFragment, DocumentType, Notation, Entity, EntityReference都node的子类型
并不说说node(子类型)不能绑定事件,而是有些类型的node不可见,不支持事件绑定,