IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 1 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Javascript Quine?
Not strictly speaking a true [link|http://www.nyx.net/~gthompso/self_javas.txt|quine] but....

I need to write a javascript function that reads the html for the current document and puts it into a hidden field on a form. The idea is to have the function run through the document and recreate it.

Anyone know of a function for that purpose.

Thanks.
New Maybe like this?
window.document.getElementsByTagName('html')[0].innerHTML

As in:
\n<html>\n<head><title>HTML Test</title></head>\n<body>\n<script language="javascript">\nfunction mook()\n{\n\talert(window.document.getElementsByTagName('html')[0].innerHTML);\n}\n</script>\n<a href="javascript:mook()">Mook me, bay-bee.</a>\n</body>\n</html>\n
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Just right
I knew there had to be a way to get it all at once. Beats what I was attempting in my reconstruction via traversal. Thanks!
New :-)
Traversal is good for some things, but definitely not for this.

I think they should have a real function for this. Something like "toHtmlText" on a DOM element object.

The problem with innerHTML is that older versions of Netscape do not support it. IE and Netscape 6+/Mozilla only.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
     Javascript Quine? - (ChrisR) - (3)
         Maybe like this? - (admin) - (2)
             Just right - (ChrisR) - (1)
                 :-) - (admin)

All that did was remind me of the fruit in the "Sledgehammer" video by Peter Gabriel.
56 ms