Meaningless Drivel is fun!
The moose likes HTML, CSS and JavaScript and the fly likes Redirecting a page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Redirecting a page" Watch "Redirecting a page" New topic

Redirecting a page

Phil Perkins
Ranch Hand

Joined: Nov 21, 2000
Posts: 40
I am trying to redirect using the following code
Can someone help me find the bug? PageDirect is the page that it is getting directed to.

<script language="JavaScript">
<!-- Hide the script form non-JavaScript browsers
function goToLink(form)
window.location.href = form.options[form.selectedIndex].value;
<input type="radio" name="PageDirect" value=""> Billing Information
<input type="radio" name="PageDirect" value="adminInfo.html"> Administration Information
<input type="radio" name="PageDirect" value="primaryUserInfo.html" checked> Primary Location
<input type="radio" name="PageDirect" value="otherUserInfo.html"> Secondary Location(s)
<input type="submit" value="Go" onClick="goToLink(this.form.PageDirect">
bill bozeman
Ranch Hand

Joined: Jun 30, 2000
Posts: 1070
options is not a command for radio buttons. You need to use a script that loops through the radio buttons and checks the checked status, then when you find the one that is checked, get that value. The function could look something like this:

Didn't test that, but it would look something like that.
I agree. Here's the link:
subject: Redirecting a page
It's not a secret anymore!