When using document write something is added to the HTML source code and therefore to the website. The parameter used by the person who wrote the code determines what will be added. No need for user interaction for this. However, when the window alert is used, the user has to click "Ok" or a similar button in order to continue browsing on the page that comes up.