When do we need document.close()

A

ASM

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
 
M

Martin Honnen

howa said:
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).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top