LilithX
07-06-2011, 06:30 PM
Hi,
I've checked the boards and was unable to find something that matched the code that I have. The code basically uses radio buttons to populate results to a drop-down list depending on the radio button they choose. I'm having trouble figuring out where and how to add the redirection url for each of the value choices in the drop down. I was told something about using window.location('http://url.here') and then to populate the location parameter with the array value.
Does this mean I have to redo my script or can another piece of code be added on to make it work. How do I alter my existing code? Thanks in advance for any help I can get:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
var services = new Array();
services['Tutoring'] = ['Grady', 'Holy Innocents', 'North Springs', 'Paideia', 'Riverwood', 'School Not Listed?'];
services['Recording'] = ['John Doe'];
function changechoice(choice)
{
var serviceList = services[choice];
changeSelect('service', serviceList, serviceList);
document.getElementById('service').disabled = false;
document.getElementById('service').onchange();
}
function changeservice(serviceValue)
{
document.getElementById('output').innerHTML = serviceValue;
return;
}
function changeSelect(fieldID, newValues, newOptions)
{
selectField = document.getElementById(fieldID);
selectField.options.length = 0;
if (newValues && newOptions)
{
for (i=0; i<newValues.length; i++)
{
selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
}
}
}
</script>
</head>
<body>
<table width="400" align="center" colspan="2" border="0" rowspan="2">
<tr>
<td width="200" align="left">
Pick an option:
</td>
</tr>
<td width="200">
<br>
<ul>
<input type="radio" name="choice" value="Tutoring" onclick="changechoice(this.value);"> Tutoring<br />
<input type="radio" name="choice" value="Recording" onclick="changechoice(this.value);"> Recording<br />
</ul>
</td>
<br>
<td width="200" align="center" valign="top">
<br>
<select name="service" id="service" onchange="changeservice(this.value);" disabled="disabled">
<option> -- Choose an Option -- </option>
</select>
</td>
</table>
</body>
</html>
I've checked the boards and was unable to find something that matched the code that I have. The code basically uses radio buttons to populate results to a drop-down list depending on the radio button they choose. I'm having trouble figuring out where and how to add the redirection url for each of the value choices in the drop down. I was told something about using window.location('http://url.here') and then to populate the location parameter with the array value.
Does this mean I have to redo my script or can another piece of code be added on to make it work. How do I alter my existing code? Thanks in advance for any help I can get:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
var services = new Array();
services['Tutoring'] = ['Grady', 'Holy Innocents', 'North Springs', 'Paideia', 'Riverwood', 'School Not Listed?'];
services['Recording'] = ['John Doe'];
function changechoice(choice)
{
var serviceList = services[choice];
changeSelect('service', serviceList, serviceList);
document.getElementById('service').disabled = false;
document.getElementById('service').onchange();
}
function changeservice(serviceValue)
{
document.getElementById('output').innerHTML = serviceValue;
return;
}
function changeSelect(fieldID, newValues, newOptions)
{
selectField = document.getElementById(fieldID);
selectField.options.length = 0;
if (newValues && newOptions)
{
for (i=0; i<newValues.length; i++)
{
selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
}
}
}
</script>
</head>
<body>
<table width="400" align="center" colspan="2" border="0" rowspan="2">
<tr>
<td width="200" align="left">
Pick an option:
</td>
</tr>
<td width="200">
<br>
<ul>
<input type="radio" name="choice" value="Tutoring" onclick="changechoice(this.value);"> Tutoring<br />
<input type="radio" name="choice" value="Recording" onclick="changechoice(this.value);"> Recording<br />
</ul>
</td>
<br>
<td width="200" align="center" valign="top">
<br>
<select name="service" id="service" onchange="changeservice(this.value);" disabled="disabled">
<option> -- Choose an Option -- </option>
</select>
</td>
</table>
</body>
</html>