<html xmlns="http://www./1999/xhtml"> <head> <title></title> <script type="text/javascript"> function processNode(te) { var rect = te.getBoundingClientRect(); alert(te.tagName + ":" + rect.left + "," + rect.top + ", " + rect.right + "," + rect.bottom); for (var i = 0; i < te.children.length; i++) { processNode(te.children[i]); } }
function getlayer() { alert(document.body.all.length); for (var i = 0; i < document.body.children.length; i++) { processNode(document.body.children[i]); } } </script> </head> <body>
<input value="ko"/> <input type="button" id="idin" onclick="getlayer();" value="hah" /> <div> <form> <img width="90px" height="100px" /> <ul> <li>liu</li> <li>jing</li> <li>wei</li> </ul> <input type="submit" value="submit" /> </form> </div> </body> </html>
|