Hello people,
I need some help, I have been unable to get this resolved in searching, in other forums, or anywhere. Some one please help!
This code works great in FF but doesn't at all in IE. In IE I get a generic "object expected" error which is most unhelpful.
What I am trying to do is customize my form a bit. I have a select with 6 options, each of which, when picked, bring up a slave select. Now this code already does what it is supposed to do, which is get the last one selected and not any of the other ones that may have been selected while the user was browsing. That is a requirement so I can not mess with that.
ok here is the code:
In the header we have:
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var f = document.getElementById('cou1');
var g = document.getElementById('cou2');
var h = document.getElementById('cou3');
var i = document.getElementById('cou4');
var j = document.getElementById('cou5');
var k = document.getElementById('cou6');
var e = document.getElementById(id);
f.style.display = 'none';
g.style.display = 'none';
h.style.display = 'none';
i.style.display = 'none';
j.style.display = 'none';
k.style.display = 'none';
f.getElementsByTagName("select")[0].selectedIndex = 0;
g.getElementsByTagName("select")[0].selectedIndex = 0;
h.getElementsByTagName("select")[0].selectedIndex = 0;
i.getElementsByTagName("select")[0].selectedIndex = 0;
j.getElementsByTagName("select")[0].selectedIndex = 0;
k.getElementsByTagName("select")[0].selectedIndex = 0;
if(e.style.display == 'block') {
e.style.display = 'none';
}
else {
e.style.display = 'block';
}
}
//-->
</script>
In the body tag we have:
onload="toggle_visibility(id)"
The master select is:
<option value="6" Selected>No Bus Pick Up Needed</option>
<option value="2" onclick="toggle_visibility('cou1')">location1</option>
<option value="3" onclick="toggle_visibility('cou2')">location2</option>
<option value="4" onclick="toggle_visibility('cou3')">location3</option>
<option value="19" onclick="toggle_visibility('cou4')">location4</option>
<option value="20" onclick="toggle_visibility('cou5')">location5</option>
<option value="21" onclick="toggle_visibility('cou6')">location6</option>
</SELECT>
(BTW, onchange makes it worse. It doesn't work in FF with that)
ok, and now the slave divs.....
<div style="display:none;" id="cou0"> </div>
<div style="display:none;" id="cou1"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou2"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou3"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou3"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou4"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou5"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou6"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
end coding
I think I have it all in there. I have spent 2 weeks working on this off and on. Like I said, it works beautifully in FF but not at all in IE. I have researched and tested and then researched and tested and did researched and tested. I think I have done every conceivable option. I hate IE.
If there is a totally different way of doing this, I'm open.
Thanks for looking.
Barter
I need some help, I have been unable to get this resolved in searching, in other forums, or anywhere. Some one please help!
This code works great in FF but doesn't at all in IE. In IE I get a generic "object expected" error which is most unhelpful.
What I am trying to do is customize my form a bit. I have a select with 6 options, each of which, when picked, bring up a slave select. Now this code already does what it is supposed to do, which is get the last one selected and not any of the other ones that may have been selected while the user was browsing. That is a requirement so I can not mess with that.
ok here is the code:
In the header we have:
<script type="text/javascript">
<!--
function toggle_visibility(id) {
var f = document.getElementById('cou1');
var g = document.getElementById('cou2');
var h = document.getElementById('cou3');
var i = document.getElementById('cou4');
var j = document.getElementById('cou5');
var k = document.getElementById('cou6');
var e = document.getElementById(id);
f.style.display = 'none';
g.style.display = 'none';
h.style.display = 'none';
i.style.display = 'none';
j.style.display = 'none';
k.style.display = 'none';
f.getElementsByTagName("select")[0].selectedIndex = 0;
g.getElementsByTagName("select")[0].selectedIndex = 0;
h.getElementsByTagName("select")[0].selectedIndex = 0;
i.getElementsByTagName("select")[0].selectedIndex = 0;
j.getElementsByTagName("select")[0].selectedIndex = 0;
k.getElementsByTagName("select")[0].selectedIndex = 0;
if(e.style.display == 'block') {
e.style.display = 'none';
}
else {
e.style.display = 'block';
}
}
//-->
</script>
In the body tag we have:
onload="toggle_visibility(id)"
The master select is:
<option value="6" Selected>No Bus Pick Up Needed</option>
<option value="2" onclick="toggle_visibility('cou1')">location1</option>
<option value="3" onclick="toggle_visibility('cou2')">location2</option>
<option value="4" onclick="toggle_visibility('cou3')">location3</option>
<option value="19" onclick="toggle_visibility('cou4')">location4</option>
<option value="20" onclick="toggle_visibility('cou5')">location5</option>
<option value="21" onclick="toggle_visibility('cou6')">location6</option>
</SELECT>
(BTW, onchange makes it worse. It doesn't work in FF with that)
ok, and now the slave divs.....
<div style="display:none;" id="cou0"> </div>
<div style="display:none;" id="cou1"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou2"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou3"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou3"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou4"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou5"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
<div style="display:none;" id="cou6"><p><select name="specific_area"><option value="" Selected></option><option value="value">20 or so options</option></p></div>
end coding
I think I have it all in there. I have spent 2 weeks working on this off and on. Like I said, it works beautifully in FF but not at all in IE. I have researched and tested and then researched and tested and did researched and tested. I think I have done every conceivable option. I hate IE.
If there is a totally different way of doing this, I'm open.
Thanks for looking.
Barter