+ 4
document.write function in java script takes to another screen why
Whenever I use the document.write function to print something it takes me to another screen ,how to prevent that from happening
5 Réponses
+ 3
Even if you document.write() after the html loaded, it will overwrite it, because it write text directly in the Document object, which contains html ^^
For update you document content without "takes you to another screen" ( clear the content ), you may avoid document.write() use, and use the innerHTML property of html's elements...
+ 3
I don't understand it what do you mean by before the html
+ 3
thanks
+ 3
it works when I use it directly but when I use it as a function in a button it prints on another screen
+ 2
you write the document before the html load, so it overwrites the content