But Philip, as ill-advised as his code is, he is *NOT* invoking document.write after the page is load at any point in that code.
He has various OTHER problems on that page. Such as a missing }. And more.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.