View Full Version : Radio and Submit Button

09-30-2008, 02:29 PM
I want to create several options (radio buttons) where only one can be selected. I then want a different webpage to be associated with each choice so when the submit button is press it will go to the webpage that the radio button links to.

i know how to create a simple radio button and make it so only one can be selected. I am unsure how to do the different links and how to go to the link when a button is pressed. Can someone please help.

09-30-2008, 03:22 PM
Here's a basic example for you to keep going:

<script type="text/javascript">
function link(inpName)
var rad=document.getElementsByName(inpName),store;
for(var i=0;i<rad.length;i++)
<label>Google: </label><input type="radio" name="web" value="google"><br>
<label>Yahoo: </label><input type="radio" name="web" value="yahoo"><br>
<input type="button" value="Submit" onclick="link('web')"><br><br>
<label>HF: </label><input type="radio" name="forum" value="htmlforums"><br>
<label>CF: </label><input type="radio" name="forum" value="codingforums"><br>
<input type="button" value="Submit" onclick="link('forum')"><br><br>