Quote:
Originally Posted by djh101
document.write seems to work just fine. Isn't it lovely when you solve your own problems? 8)
|
But in solving that one problem that way you now have a hundred more just waiting to happen the next time you touch the code in the page. There are lots of reasons why you should never use document.write in a script running against a web page and not knowing how to write JavaScript properly is the only reason now for doing so.
Unless you still run Netscape 4 you should consider document.write to be dead and gone as that is the most recent browser that requires that you use such messy obtrusive statements as document.write - that call is now only needed in userscripts that are generating new web pages from someone else's web page that you have loaded into your browser (such as a dynamic view source that shows the way the source looks after the JavaScript has updated it).
If the different ways JavaScript can update the web page were dates then the DOM would be 2012, innerHTML would be 2010 and document.write would be 12 billion BC.