Click to See Complete Forum and Search --> : add instead of replace
xataku_nakusute
07-29-2003, 06:17 AM
document.write will replace the page...but how do i add it to the end(or other specified area)?
ive seen something that looked like this once:
document.writeln(....
btw, if you cant tell....ln=LN
gil davis
07-29-2003, 06:44 AM
If you use document.write() in a script that will be executed before the document is finished loading, then the action is to add on to the existing page. However, if the document has finished loading, it is closed and any subsequent document.write() instructions will do an intrinsic document.open() which will destroy the current document.
Newer browsers that follow the W3C DOM give you ways to create new text nodes and append them to the document without destroying what is already there.
Charles
07-29-2003, 10:18 AM
You can find the W3C DOM at http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/.
Note, however, that it is a real pain in the keister to add elements and text using the W3C DOM. It's much easier to use the non-standard 'Element.innerHTML' and 'Element.innerText' properties. Though non-standard they are about as widely supported as JavaScript itself. But that's not saying much. So make your page work as well with as without JavaScript then you don't have to worry about it.