<!DOCTYPE HTML> <html> <body> <script> function traverseDOMTree(targetDocument, currentElement, depth) { if (currentElement) { var j; var tagName=currentElement.tagName; if (tagName){ targetDocument.writeln("<"+currentElement.tagName+">"); var elid = currentElement.tagName; var elem1 = document.getElementsByTagName(elid); var style = window.getComputedStyle(elem1[0], null); alert(style); var len = style.length; var str = ''; for (i = 0; i < len; i++) { //alert(i); if (window.getComputedStyle(document.getElementsByTagName(elid)[0], null).getPropertyValue(style[i]) != null) str = str + style[i] + ':' + window.getComputedStyle(document.getElementsByTagName(elid)[0], null).getPropertyValue(style[i]) + ';\n'; } targetDocument.writeln("<"+str+">"); } else targetDocument.writeln("[unknown tag]"); var i=0; var currentElementChild=currentElement.childNodes[i]; while (currentElementChild) { targetDocument.write("<br>\n"); for (j=0; j<depth;> { targetDocument.write(" ¦"); } targetDocument.writeln("<br>"); for (j=0; j<depth;> { targetDocument.write(" ¦"); } if (tagName) targetDocument.write("--"); traverseDOMTree(targetDocument, currentElementChild, depth+1); i++; currentElementChild=currentElement.childNodes[i]; } targetDocument.writeln("<br>"); for (j=0; j<depth-1;> { targetDocument.write(" ¦"); } targetDocument.writeln(" "); if (tagName) targetDocument.writeln("</"+tagName+">"); } } function printDOMTree(domElement, destinationWindow) { var outputWindow=destinationWindow; if (!outputWindow) outputWindow=window.open(); outputWindow.document.open("text/html", "replace"); outputWindow.document.write("<HTML><HEAD><TITLE>DOM</TITLE></HEAD><BODY>\n"); outputWindow.document.write("<code>\n"); traverseDOMTree(outputWindow.document, domElement, 1); outputWindow.document.write("</code>\n"); outputWindow.document.write("</BODY></HTML>\n"); outputWindow.document.close(); } </script> <div id="div2"> <table style="border-top-style:solid"> <tr> <td>Telephony By Country</td> <td>Jan-2013</td> <td>Feb-2013</td> <td>Mar-2013</td> </tr> <tr> <td class="tdhighlight">Calls Offered</td> <td>33555</td> <td>28201</td> <td>27563</td> </tr> <tr> </tr></table> </div> <button onclick="printDOMTree(document.getElementById('div2'));" style="width:100px">Go!</button> </body> </html> please help me as soon as possible.......... It is urgent!</br></br></br>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)