RobG wrote:
Alex Vassiliev wrote:
All regular benefits of web application:
(1) easy to deploy with my application
(2) multiple browsers compatibility
Plus, if source code is available, I can invoke it from my js
application when it is exactly in the state I wanted to inspect plus I
can pass the reference to the exact object I wanted to inspect.
[...]
Here is a 'DOMwalk' script I wrote some time ago as a quick 'n dirty
tree dump. If you give domReport() an id it will walk down from there.
If no id is given, it starts from the html element. I've tested it in
most modern browsers and it seems to be fine.
[...]
And here's the script... :-x
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title> DOMwalk </title>
<meta http-equiv="Content-Type"
content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
var rpt = [];
function domWalk(n,x) {
rpt.push('<tr>< td>' + x
+ '</td><td>' + n.nodeName
+ '</td><td>' + n.nodeType
+ '</tr>');
for (var i=0; i<n.childNodes. length; i++) {
domWalk(n.child Nodes[i],x+'.'+i);
}
}
function domReport(s){
rpt.length = 0;
rpt.push('<tabl e><tr><th>Index </th>'
+ '<th>nodeName</th><th>nodeType </th></tr>');
if ( s && '' != s) {
domWalk(documen t.getElementByI d(s),'');
} else {
domWalk(documen t.getElementsBy TagName('html')[0],'0');
}
rpt.push('</table>');
document.getEle mentById('xx'). innerHTML = rpt.join('');
}
</script>
</head>
<body onload="domRepo rt();">
<div>
<p>this stuff is just so that there is something
in the document to report on.</p>
<p>Here is <b>some</b> text</p>
<p>Here is <b>some</b> <i>text</i></p>
<p>Here is some text</p>
</div>
<div id="xx"></div>
</body>
</html>
--
Rob