[thelist] Debugging JavaScript written HTML

Hershel Robinson hershelr at netvision.net.il
Fri Jul 23 04:14:12 CDT 2004


> How can I look at the HTML code that my
> script is writing
> when only the originally loaded source is available through
> the browser?

Try this bookmarklet:

javascript:var%20o=document.documentElement,p,w=window.open('','_blank'),d=w
.document;d.write('<html><body><pre>');z('<'+o.tagName);for(var%20i=0;p=o.at
tributes[i],i!=o.attributes.length;i++)if(p.specified)z('%20'+p.nodeName+'="
'+p.nodeValue+'"');z('>'+o.innerHTML+'</'+o.tagName+'>');d.write('</pre></bo
dy></html>');d.close();function%20z(s){d.write(s.replace(/&/g,'&amp;').repla
ce(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;'));}

I didnt' write it. I found it somewhere (forgot where) and it's called 'Show
Source.'

Hershel



More information about the thelist mailing list