...

View Full Version : outerText/Html of the intire document?



kwhubby
02-21-2003, 06:58 AM
hey how do you get the html, or text of the intire document or body

,

so just getting the source code of the page

Borgtex
02-21-2003, 12:27 PM
try this:

alert(document.getElementsByTagName('HTML')[0].outerHTML)

kwhubby
02-21-2003, 10:24 PM
thanks :) , i never thought of going back to the html tag

jkd
02-21-2003, 10:30 PM
document.documentElement would also refer to the <html> element in an HTML document. :)

kwhubby
02-21-2003, 10:31 PM
how would you do that with a frame, or iframe

(eg named asdf)

would it be (for an iframe)
alert(document.all.asdf.document.getElementsByTagName('HTML')[0].innerHTML)

Borgtex
02-22-2003, 01:10 AM
for an iframe, i think that:

alert(asdf.document.getElementsByTagName('HTML')[0].innerHTML)

is enough

kwhubby
02-22-2003, 03:04 AM
is there a way to do that if the iframe is browsed to a text document, not an html file. So I don't have to start at the <html> tag.. (of course its all on the same server so it won't couse permision errors for cross domains)

edit:
nm, it worked anyway with a text document!!
:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum