rjg117
03-03-2010, 04:23 AM
Hi, I'm really new to Javascript. Recently in my IT class, we made a HTML page which would open a popup box, where the user could enter a key word. When the user pressed enter, the page would navigate to a specific page. The code we used was:
<script language = "JavaScript">
where = window.prompt ("Please tell me where you would like to go.");
switch (where){
case "Digg" :
window.location = "http://www.digg.com" ;
break;
default:
window.location = "http://www.google.com" ;
}
</script>
What I am hopeing to do, is implement this code on my workplaces server, and have the keywords link to other html documents within the server. However when I tested this, for some reason the links are not working. Can this actually be done? Am I missing something silly? Are there any other ways of doing this?
Thanks in advance
<script language = "JavaScript">
where = window.prompt ("Please tell me where you would like to go.");
switch (where){
case "Digg" :
window.location = "http://www.digg.com" ;
break;
default:
window.location = "http://www.google.com" ;
}
</script>
What I am hopeing to do, is implement this code on my workplaces server, and have the keywords link to other html documents within the server. However when I tested this, for some reason the links are not working. Can this actually be done? Am I missing something silly? Are there any other ways of doing this?
Thanks in advance