Results 1 to 2 of 2

Thread: document write (JS)

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default document write (JS)

    How can I print a string, on html document, on the current window?

    when I use:

    PHP Code:
    document.write(x); 
    it opens a new page, and I want it to be desplayed in the body of the current window.

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    d-machine (01-21-2011)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •