- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>无标题文档</title>
- <script type="text/javascript">
-
-
-
- function listAll(node)
- {
-
- var nodes = node.childNodes;
- for(var x = 0; x<nodes.length ;x++)
- {
- if(nodes[x].hasChildNodes())
- listAll(nodes[x]);
- else
- getInfo(nodes[x]);
- }
-
- }
- function list()
- {
-
- listAll(document);
- }
-
-
- function getInfo (node) {
-
- document.write("name:"+node.nodeName+"..type:"+node.nodeType+"..value:"+node.nodeValue);
- }
- </script>
- </head>
- <body>
- <input type = "button" value = "按我" onclick="list()"></input>
- <div id = "divid">
- 水电费;
- </div>
- <table id= "table">
- <tr>
- <td>第一个</td>
- <td>第二个</td>
- </tr>
- <tr>
- <td>第三个</td>
- <td>第四个</td>
- </tr>
- </table>
- <a >百度</a>
- </body>
- </html>
复制代码 |