Build a website with javascript games and other dynamic content

Step Six - change location


If you click on the button above a short function will be executed which will bring you to the file step6.htm (where we are already.) That button was defined like

<input type="button"

onclick="go_to_url('step6.htm')"

value="go nowhere" >

and calls the following script.

<script>

function go_to_url(target_url)

{

window.location.href=target_url

}

<script>



In the script the give URL was assigned to be the hyper reference of the browsers window current location. If it would have been different a new page would have been loaded. It is effectivly just as if a user clicks on a link. The difference is that the script changes the location by itself.

Next step

 

AK
Start

My Games

Get Games

Build Games
space
1 - simple javascripts
2 - change form values
3 - statusbar & mouse
4 - change images
5 - preload images
6 - change location
7 - open/close windows
8 - other sources

Feedback or Questions

about me

 
 

Copyright by Armin Kielack 1998 last modified: