Is there a general rule, when one should use document.write
to change the website content and when to use .innerHTML
?
So far my rules were:
1) Use document.write
when adding new content
2) Use .innerHTML
when changing existing content
But I got confused, since someone told me that on the one hand .innerHTML
is a strange Microsoft standard, but on the other hand I read that document.write
is not allowed in XHTML.
Which structures should I use to manipulate my source code with JavaScript?