Skip to main content
GameDev.net gamedev.net
🔒 Locked

[web] document.open

Started by EvilCrap Sep 12, 2005 at 10:43 AM 1 replies 950+ views
Original Post
EvilCrap
EvilCrap
document.open seems to erase all of the current html. Is there a way to fetch the html before an open, so that I can write it back out with other stuff? For instance, I would like to preserve style definitions in the header, and various inputs in the body, but I would like to write out additional inputs.
Sander
Sander
If you just want to add a few things then it might be easier actually adding to the current page, instead of saving off the old page, opening a new one and splicing the old contents back in. Have a look at the innerHTML property or at XML-DOM scripting to do that.
EvilCrap
EvilCrap
getElementsByTagName("body")[0].innerHTML works great.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.