I'm designing a page that allows the user to choose from 3 different sets of radio button options, then click to be redirected to a page that is appropriate to the selection.
Any help will be appreciated. (Many of the links in this example are repeated, the working code will contain unique links.)
Thanks,
Jean
Here is the code:
<html>
<head>
<title>More Choices</title>
<script language="JavaScript">
var allOne = new Array ();
allOne[0] = "http://www.maskwoman.biz";
allOne[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allOne[2] = "http://www.maskwoman.biz/animals.htm";
allOne[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allOne[4] = "http://www.maskwoman.biz/portraits.htm";
var businessOne = new Array ();
businessOne[0] = "http://www.maskwoman.biz";
businessOne[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksOne = new Array ();
masksOne[0] = "http://www.maskwoman.biz/animals.htm";
masksOne[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksOne[2] = "http://www.maskwoman.biz/portraits.htm";
var allTwo = new Array ();
allTwo[0] = "http://www.maskwoman.biz";
allTwo[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allTwo[2] = "http://www.maskwoman.biz/animals.htm";
allTwo[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allTwo[4] = "http://www.maskwoman.biz/portraits.htm";
var businessTwo = new Array ();
businessTwo[0] = "http://www.maskwoman.biz";
businessTwo[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksTwo = new Array ();
masksTwo[0] = "http://www.maskwoman.biz/animals.htm";
masksTwo[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksTwo[2] = "http://www.maskwoman.biz/portraits.htm";
var allThree = new Array ();
allThree[0] = "http://www.maskwoman.biz";
allThree[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allThree[2] = "http://www.maskwoman.biz/animals.htm";
allThree[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allThree[4] = "http://www.maskwoman.biz/portraits.htm";
var businessThree = new Array ();
businessThree[0] = "http://www.maskwoman.biz";
businessThree[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksThree = new Array ();
masksThree[0] = "http://www.maskwoman.biz/animals.htm";
masksThree[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksThree[2] = "http://www.maskwoman.biz/portraits.htm";
var levelOne = "(document.adventure.level.one.checked)?true:false";
var levelTwo = "(document.adventure.level.two.checked)?true:false";
var levelThree = "(document.adventure.level.three.checked)?true:false";
var shorter = "(document.choose.where.first.checked)?true:false";
var short1 = "(document.choose.where.second.checked)?true:false";
var long1 = "(document.choose.where.third.checked)?true:false";
var nothanks = "(document.list.not.no.checked)?true:false";
var yesplease = "(document.list.not.yes.checked)?true:false";
function whereTo () {
if (levelOne && shorter && nothanks == true) {
window.location = masksOne[Math.floor(Math.random() * masksOne.length)];
}
if (levelOne && short1 && nothanks == true) {
window.location = businessOne[Math.floor(Math.random() * businessOne.length)];
}
if (levelOne && long1 && nothanks == true) {
window.location = allOne[Math.floor(Math.random() * allOne.length)];
}
if (levelTwo && shorter && nothanks == true) {
window.location = masksTwo[Math.floor(Math.random() * masksTwo.length)];
}
if (levelTwo && short1 && nothanks == true) {
window.location = businessTwo[Math.floor(Math.random() * businessTwo.length)];
}
if (levelTwo && long1 && nothanks == true) {
window.location = allTwo[Math.floor(Math.random() * allTwo.length)];
}
if (levelThree && shorter && nothanks == true) {
window.location = masksThree[Math.floor(Math.random() * masksThree.length)];
}
if (levelThree && short1 && nothanks == true) {
window.location = businessThree[Math.floor(Math.random() * businessThree.length)];
}
if (levelThree && long1 && nothanks == true) {
window.location = allThree[Math.floor(Math.random() * allThree.length)];
}
if (levelOne && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelOne && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelOne && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
}
</script>
</head>
<body>
<p><h3>Choose a level</h3></p>
<form name="adventure">
<input type="radio" name="level" value="one">First List<br>
<input Type="radio" name="level" value="two">Second List<br>
<input type="radio" name="level" value="three">Third List<br>
</form>
<h3>What do you want to see?</h3>
<form>
<form name ="choose">
<input type="radio" name="where" VALUE="first"> Conduct Business<br>
<input type="radio" name="who" VALUE="second"> Look at Masks<br>
<input type="radio" name="who" value="third"> All
</form>
<h3>Print a list?</h3>
<form>
<form name = "list">
<input type="radio" name="not" VALUE="No"> No<br>
<input type="radio" name="not" VALUE="Yes"> Yes<br>
<input type="button" onclick=" return whereTo()" value="Where?">
</form>
</body>
</html>
Any help will be appreciated. (Many of the links in this example are repeated, the working code will contain unique links.)
Thanks,
Jean
Here is the code:
<html>
<head>
<title>More Choices</title>
<script language="JavaScript">
var allOne = new Array ();
allOne[0] = "http://www.maskwoman.biz";
allOne[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allOne[2] = "http://www.maskwoman.biz/animals.htm";
allOne[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allOne[4] = "http://www.maskwoman.biz/portraits.htm";
var businessOne = new Array ();
businessOne[0] = "http://www.maskwoman.biz";
businessOne[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksOne = new Array ();
masksOne[0] = "http://www.maskwoman.biz/animals.htm";
masksOne[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksOne[2] = "http://www.maskwoman.biz/portraits.htm";
var allTwo = new Array ();
allTwo[0] = "http://www.maskwoman.biz";
allTwo[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allTwo[2] = "http://www.maskwoman.biz/animals.htm";
allTwo[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allTwo[4] = "http://www.maskwoman.biz/portraits.htm";
var businessTwo = new Array ();
businessTwo[0] = "http://www.maskwoman.biz";
businessTwo[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksTwo = new Array ();
masksTwo[0] = "http://www.maskwoman.biz/animals.htm";
masksTwo[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksTwo[2] = "http://www.maskwoman.biz/portraits.htm";
var allThree = new Array ();
allThree[0] = "http://www.maskwoman.biz";
allThree[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
allThree[2] = "http://www.maskwoman.biz/animals.htm";
allThree[3] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
allThree[4] = "http://www.maskwoman.biz/portraits.htm";
var businessThree = new Array ();
businessThree[0] = "http://www.maskwoman.biz";
businessThree[1] = "http://www.maskwoman.biz/catalog.htm#catalog";
var masksThree = new Array ();
masksThree[0] = "http://www.maskwoman.biz/animals.htm";
masksThree[1] = "http://www.maskwoman.biz/fantasy.htm#fantasy";
masksThree[2] = "http://www.maskwoman.biz/portraits.htm";
var levelOne = "(document.adventure.level.one.checked)?true:false";
var levelTwo = "(document.adventure.level.two.checked)?true:false";
var levelThree = "(document.adventure.level.three.checked)?true:false";
var shorter = "(document.choose.where.first.checked)?true:false";
var short1 = "(document.choose.where.second.checked)?true:false";
var long1 = "(document.choose.where.third.checked)?true:false";
var nothanks = "(document.list.not.no.checked)?true:false";
var yesplease = "(document.list.not.yes.checked)?true:false";
function whereTo () {
if (levelOne && shorter && nothanks == true) {
window.location = masksOne[Math.floor(Math.random() * masksOne.length)];
}
if (levelOne && short1 && nothanks == true) {
window.location = businessOne[Math.floor(Math.random() * businessOne.length)];
}
if (levelOne && long1 && nothanks == true) {
window.location = allOne[Math.floor(Math.random() * allOne.length)];
}
if (levelTwo && shorter && nothanks == true) {
window.location = masksTwo[Math.floor(Math.random() * masksTwo.length)];
}
if (levelTwo && short1 && nothanks == true) {
window.location = businessTwo[Math.floor(Math.random() * businessTwo.length)];
}
if (levelTwo && long1 && nothanks == true) {
window.location = allTwo[Math.floor(Math.random() * allTwo.length)];
}
if (levelThree && shorter && nothanks == true) {
window.location = masksThree[Math.floor(Math.random() * masksThree.length)];
}
if (levelThree && short1 && nothanks == true) {
window.location = businessThree[Math.floor(Math.random() * businessThree.length)];
}
if (levelThree && long1 && nothanks == true) {
window.location = allThree[Math.floor(Math.random() * allThree.length)];
}
if (levelOne && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelOne && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelOne && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelTwo && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && shorter && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && short1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
if (levelThree && long1 && yesplease == true) {
window.location = "http://www.maskwoman.biz";
}
}
</script>
</head>
<body>
<p><h3>Choose a level</h3></p>
<form name="adventure">
<input type="radio" name="level" value="one">First List<br>
<input Type="radio" name="level" value="two">Second List<br>
<input type="radio" name="level" value="three">Third List<br>
</form>
<h3>What do you want to see?</h3>
<form>
<form name ="choose">
<input type="radio" name="where" VALUE="first"> Conduct Business<br>
<input type="radio" name="who" VALUE="second"> Look at Masks<br>
<input type="radio" name="who" value="third"> All
</form>
<h3>Print a list?</h3>
<form>
<form name = "list">
<input type="radio" name="not" VALUE="No"> No<br>
<input type="radio" name="not" VALUE="Yes"> Yes<br>
<input type="button" onclick=" return whereTo()" value="Where?">
</form>
</body>
</html>
Comment