 <p>Because when you call <code>document.write</code> the first time, it removes all links from the DOM. It replaces the entire innerHTML of <code>document.body</code> with "Hello: ".</p> <p>You should never use <code>document.write</code> anyway.</p>