E
eroot
Please help! This is the last coding hurdle before I am done with the
site I am presently working on. It seems like this should work, but it
isn't. (What is suppose to happen: when you select the option you want
from the drop down menu the appropriate <div> becomes visible). I have
put in some alerts to see where the code is failing, and for some
reason in Netscape it isn't completing the sequence. It seems like it
should be easy to fix... agh! Thank you.
<!--
function changeForm(what) {
for (var i=0; i<what.options.length; i++)
{
alert('number of options: ' + what.options.length)
if (what.options.selected) {
alert('selected ' + i)
if(document.all) {
alert('sees document.all')
document.all[what.options.value].style.visibility="visible";
} else if (document.layers){
alert('sees document.layers')
document.layers[what.options.value].visibility =
"visible";
} else {
alert('sees none')
document.all[what.options.value].style.visibility="visible";
}
} else {
alert('deselect ' + i)
if(document.all) {
alert('sees document.all')
document.all[what.options.value].style.visibility="hidden";
} else if (document.layers){
alert('sees document.layers')
document.layers[what.options.value].visibility =
"hidden";
} else {
alert('sees no')
document.all[what.options.value].style.visibility="hidden";
}
}
}
}
//-->
</script>
</head>
<FORM>
<SELECT NAME="selectList" onChange="changeForm(this.form.selectList)">
<OPTION VALUE="form1" SELECTED>Question 1
<OPTION VALUE="form2">Question 2
<OPTION VALUE="form3">Question 3
</SELECT>
<br>
<DIV STYLE="position: absolute">
</DIV>
<DIV ID="form1" style="position: absolute; visibility: visible;">
Answer 1
</DIV>
<DIV ID="form2" style="position: absolute; visibility: hidden;">
Answer 2
</DIV>
<DIV ID="form3" style="position: absolute; visibility: hidden;">
Answer 3 -
</DIV>
site I am presently working on. It seems like this should work, but it
isn't. (What is suppose to happen: when you select the option you want
from the drop down menu the appropriate <div> becomes visible). I have
put in some alerts to see where the code is failing, and for some
reason in Netscape it isn't completing the sequence. It seems like it
should be easy to fix... agh! Thank you.
<!--
function changeForm(what) {
for (var i=0; i<what.options.length; i++)
{
alert('number of options: ' + what.options.length)
if (what.options.selected) {
alert('selected ' + i)
if(document.all) {
alert('sees document.all')
document.all[what.options.value].style.visibility="visible";
} else if (document.layers){
alert('sees document.layers')
document.layers[what.options.value].visibility =
"visible";
} else {
alert('sees none')
document.all[what.options.value].style.visibility="visible";
}
} else {
alert('deselect ' + i)
if(document.all) {
alert('sees document.all')
document.all[what.options.value].style.visibility="hidden";
} else if (document.layers){
alert('sees document.layers')
document.layers[what.options.value].visibility =
"hidden";
} else {
alert('sees no')
document.all[what.options.value].style.visibility="hidden";
}
}
}
}
//-->
</script>
</head>
<FORM>
<SELECT NAME="selectList" onChange="changeForm(this.form.selectList)">
<OPTION VALUE="form1" SELECTED>Question 1
<OPTION VALUE="form2">Question 2
<OPTION VALUE="form3">Question 3
</SELECT>
<br>
<DIV STYLE="position: absolute">
</DIV>
<DIV ID="form1" style="position: absolute; visibility: visible;">
Answer 1
</DIV>
<DIV ID="form2" style="position: absolute; visibility: hidden;">
Answer 2
</DIV>
<DIV ID="form3" style="position: absolute; visibility: hidden;">
Answer 3 -
</DIV>