Tool version compatibility problem
DOM yes Document Object Model( Document object model ) Abbreviation for .
Correct
DOM It's a html It is an idea to operate all kinds of data as objects . Like a hyperlink , As a DOM Object , You can hide it , Modify its href Address to .
DOM Put all the html All converted to nodes
Entire document Is a node Element Is node Element attribute Is node Element content Is node notes It is also a node As in this example Through document.getElementById Got id=d1 of div label Corresponding Element node Then pass attributes The corresponding of the node is obtained Attribute node Then pass childNodes Got Content node
<html> <body> <div id="d1">hello HTML DOM</div> </body> <script> function p(s){ document.write(s); document.write("<br>"); } var div1 = document.getElementById("d1"); p(" Document node "+document); p(" Element "+div1); p(" Attribute node "+div1.attributes[0]); p(" Content node "+div1.childNodes[0]); </script> </html>
<html> <body> <div id="d1">hello HTML DOM</div> </body> <script> function p(s){ document.write(s); document.write("<br>"); } var div1 = document.getElementById("d1"); p(" Document node "+document); p(" Element "+div1); p(" Attribute node "+div1.attributes[0]); p(" Content node "+div1.childNodes[0]); </script> </html>
The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .
![]()
Q & A area
2019-09-02
attributes[0] and childnode[0]
2 One answer
Liu Yiyi Jump to the problem location Answer time :2019-09-18
There is more than one attribute and child node ~Id But it's the only one
13500 Jin Jump to the problem location Answer time :2019-09-08
3213
3213
The answer has been submitted successfully , Auditing . Please
My answer Check the answer record at , thank you
Please... Before asking questions land
The question has been submitted successfully , Auditing . Please
My question Check the question record at , thank you
|