document.write() can only be used while the document is "open" (i.e. while the page is loading), not in response to any event such as the load event.
If you call document.write() in an event handler, the document has already been closed. So document.write() opens a *new* document to write into, which deletes the existing document. That's why you get a blank page if you do that. You can either use document.write in code that's called directly while the document loads - not inside an event handler - or you can use one of the techniques mentioned in the thread. -Mike > From: Derba > > scratch that, including the document.write line in $(window).load > (function() causes some error while leads to just a blank > page in the browser. > > Using the first line of document.write('<style type="text/ > css">#mainimage{visibility:hidden}</style>'); seems to work > fine thought. > > On Apr 4, 8:03 pm, Derba <ryancolantu...@gmail.com> wrote: > > I tried the document.write method you told me to try, but using it > > anywhere causes the whole webpage to load up as a blank > page. I have > > NO idea whats happening. >