|
Q576 How can I make a form which has three sections of radio buttons that will take the user to a specific page based upon their selections?
irt.org | Knowledge Base | JavaScript | Form 8 | Q576 [ previous next ]
Q576 How can I make a form which has three sections of radio buttons that will take the user to a specific page based upon their selections?
It depends on what you are trying to do, but the following might
give you some ideas:
<html>
<head>
<script language="JavaScript"><!--
function go(what) {
for (var i=0; i<3; i++) {
if (what.one[i].checked == true)
var one = what.one[i].value;
if (what.two[i].checked == true)
var two = what.two[i].value;
if (what.three[i].checked == true)
var three = what.three[i].value;
}
location.href = one + two + three;
}
//--></script>
</head>
<body>
<form>
a: <input type="radio" name="one" value="a" checked>
b: <input type="radio" name="one" value="b">
c: <input type="radio" name="one" value="c">
<br>
1: <input type="radio" name="two" value="1">
2: <input type="radio" name="two" value="2" checked>
3: <input type="radio" name="two" value="3">
<br>
.htm: <input type="radio" name="three" value=".htm">
.html: <input type="radio" name="three" value=".html">
.txt: <input type="radio" name="three" value=".txt" checked>
<p>
<input type="button" onClick="go(this.form)" value="Go">
</form>
</body>
|
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.