JavaScript Example #4
Changing the URL that the browser is viewing
This example shows how you can use JavaScript to change the URL your browser is using (sort of like clicking on an HTML link, without the link). The window object has a location attribute that you can change. As an example as to how to show this, see the code below
<html>
<body>
<script type="text/javascript"> function goToweb7(){
window.location="https://web7.jhuep.com";
}
</script>
<p>URL Example. After pressing the button, you'll be sent to web7.apl.jhuj.edu</p>
<input type=button onclick="goToweb7()" value="Click me! />
</body>
</html>