When do we need document.close()

Discussion in 'Javascript' started by howa, Dec 9, 2006.

  1. howa

    howa Guest

    Should we add document.close after each time when we used
    document.write() ?
    howa, Dec 9, 2006
    #1
    1. Advertising

  2. howa

    ASM Guest

    howa a écrit :
    > Should we add document.close after each time when we used
    > document.write() ?


    All depends if you want to add some more writing later or not

    But all long document isn't closed browser continues to work and to use CPU

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
    Stephane Moriaux and his (less) old Mac already out of date
    ASM, Dec 9, 2006
    #2
    1. Advertising

  3. howa wrote:
    > Should we add document.close after each time when we used
    > document.write() ?


    No, while the document loads you can use document.write() with calling
    close yourself. However if you use document.write() after the document
    has been loaded completely it implictly does a document.open() to
    overwrite the loaded document and then your code has to do
    document.close() once you are finished writing the new document (which
    can be after several document.write() calls).


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Dec 9, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Denon
    Replies:
    1
    Views:
    558
    Saravana [MVP]
    Nov 14, 2003
  2. Daniel Albisser
    Replies:
    1
    Views:
    1,054
    GaryM
    Apr 7, 2004
  3. tshad
    Replies:
    1
    Views:
    453
    Scott M.
    Sep 6, 2006
  4. Iñaki Baz Castillo
    Replies:
    7
    Views:
    815
    Iñaki Baz Castillo
    Jan 12, 2010
  5. hyejin
    Replies:
    8
    Views:
    325
    Martin Honnen
    Aug 29, 2006
Loading...

Share This Page