PDA

View Full Version : document write (JS)



d-machine
01-20-2011, 09:39 PM
How can I print a string, on html document, on the current window?

when I use:


document.write(x);

it opens a new page, and I want it to be desplayed in the body of the current window.

Thanks :)

jscheuer1
01-21-2011, 06:21 AM
In order to avoid that, the document.write() method may only be employed as the page is being parsed (loaded).

You can use an element's innerHTML property to write to an element. That's actually non-standard. But it's used so much that it's widely supported.