I have got a form in a page that contains 2 dynamic dropdowns controls. The selection of a value included in the first dropdown will determine the content appearing on the second one. The structure is something like this:
- Code: Select all
<div >
<select name="optone" size="1" onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);">
<option value=" ">Select</option>
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Miss</option>
</select>
</div>
<div>
<select name="opttwo" size="1">
<option value="" selected ="selected">Please select one of the options above first</option>
</select>
</div>
<div>
<input type="button" name="go" value="Value Selected" onclick="open(document.myform.opttwo.options[document.myform.opttwo.selectedIndex].value);">
</div>
What I am trying to do is to open a determined page based on the values selected from the dropdown controls previously chosen. At the moment I am trying to do that with a "onClick" event on the button that will then launch whatever value is included for the selection of the dropdown. the javascripts the attribute this values is the following:
- Code: Select all
function setOptions(chosen)
{
var selbox = document.myform.opttwo;
selbox.options.length = 0;
if (chosen == " ") {
selbox.options[selbox.options.length] = new Option('Please select one of the options on the left first','Select from control next');
}
if (chosen == "1") {
selbox.options[selbox.options.length] = new Option('Accounting','www.google.com');
selbox.options[selbox.options.length] = new Option('Tax return','www.yahoo.com');
}
if (chosen == "2") {
selbox.options[selbox.options.length] = new Option('second choice - option one','twoone');
selbox.options[selbox.options.length] = new Option('second choice - option two','twotwo');
}
if (chosen == "3") {
selbox.options[selbox.options.length] = new Option('third choice - option one','threeone');
selbox.options[selbox.options.length] = new Option('third choice - option two','threetwo');
}
}
Assuming that this form is in my homepage like "mysite.com", what I would like to achieve is to open pne of the subpage of my site following the method described above.
I hope I have been managed to be clear enough.
Regards,
Antonio


