The document.write has the following disadvantages
A few of the more serious problems:
A few of the more serious problems:
- document.write (henceforth DW) does not work in XHTML
- DW executed after the page has finished loading will overwrite the page, or write a new page, or not work
- DW executes where encountered: it cannot inject at a given node point
- DW is effectively writing serialised text which is not the way the DOM works conceptually, and is an easy way to create bugs (.innerHTML has the same problem)
Reference:
http://stackoverflow.com/questions/802854/why-is-document-write-considered-a-bad-practice
No comments:
Post a Comment