Tests 2, 4 and 5 work but 1 and 3 don't. And you can probably see why. In 1 and 3, we set the window.location to a new URL. This would normally redirect the user to the new page. But after the onclick event, it runs the URL contained in the href and overrides the redirect. In this case, the # keeps the page from redirecting altogether. By putting return false; we stop the href from being processed altogether.