Welcome to WebmasterWorld Guest from 126.96.36.199 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Button Question Output text is replacing my button rather that appearing below it. 1337Mac msg:3893183 7:42 pm on Apr 15, 2009 (gmt 0) Hi. Why is it that when this button is clicked the text replaces the button rather than appears below it? Also, the browser continues to think, as if it is looping somehow. Not sure what's going on.
Thanks in advance for any help!
Fotiman msg:3893230 8:43 pm on Apr 15, 2009 (gmt 0)
You are calling document.write after the page has loaded. When you do that, whatever you write will REPLACE the document. This is one reason why document.write should be avoided. And since it replaced your document, the browser is probably waiting for <html></html> so it knows to stop processing.
Instead of document.write, use DOM methods like appendChild and createNode or createTextNode.
1337Mac msg:3893260 9:19 pm on Apr 15, 2009 (gmt 0)
OK. Thanks Fotiman.
I haven't learned of those methods yet. Looks like I've got more studying to do...
All of the tutorials I've been following so far use document.write so I just figured it was the thing to do.