WEB parsing XML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript"> var doc = new ActiveXObject("Microsoft.XMLDOM") doc.load(""); doc.async = flase; var root = doc.documentElement; //get root tag var nodes = root.childNodes;//Get all child nodes under the root label, return an array nodes.nodeType//Get the node type, 1 for label 2 for attribute 3 for text var newNode = doc.createElement("name");//Add a new node newNode.tagName//Get the tag name var textNode = doc.creatTextNode("Web programming ideas");//Add a text newNode.appendChild(textNode);//Add text to the newly added node doc.appendChild(newNode);//Add the node to the root node newNode.setAttribute("page","500"); for(var i = 0 ; i < nodes.length ; i++){ alert(nodes[i].text);//Get the text in each child node att = nodes[i].attributes;//Get the attributes of each node } </script> </head> <body> <div class="div1"></div> <div class="div2"></div> </body> </html>