三种节点:
<p title = "notes"> Don't forget buy the stuff </p>
元素节点(element node): p
文本节点(text node): Don't forget buy the stuff
属性节点(attribute node):title = “notes”
getElementById() 返回一个对象 ( 元素节点)
getElementByTagName() 参数是“li”、“p”,“ul”等标签,返回的数组 ( 元素节点)
getAttribute() 属性对象。
setAttribute()
设置属性后,源文件不会改变。
判断是否为空:if(text != null) , 简写成:if(text)
<p title = "notes"> Don't forget buy the stuff </p>
元素节点(element node): p
文本节点(text node): Don't forget buy the stuff
属性节点(attribute node):title = “notes”
getElementById() 返回一个对象 ( 元素节点)
getElementByTagName() 参数是“li”、“p”,“ul”等标签,返回的数组 ( 元素节点)
getAttribute() 属性对象。
setAttribute()
设置属性后,源文件不会改变。
判断是否为空:if(text != null) , 简写成:if(text)