Forum Moderators: open
Here's my code:
<script type="text/javascript">var lastGroup='<?php echo $member_group_ID; ?>';
var lastSemester='<?php echo $member_country_name; ?>';function changeCountry(country, semester, form){
<!--
var cValue = country.options[country.selectedIndex].value;
var sValue = form[semester].options[form[semester].selectedIndex].value;
var thisGroup=cValue+' '+sValue;document.getElementById(form[lastGroup].id).style.display='none';
document.getElementById(form[lastSemester].id).style.display='none';document.getElementById(form[semester].id).style.display='';
document.getElementById(form[thisGroup].id).style.display='';
document.getElementById(form[thisGroup].id).focus();
document.getElementById(form[thisGroup].id).style.border='1px solid #c60';lastGroup=thisGroup;
lastSemester=semester;
-->
}function goto_URL(object) {
window.location.href = 'blog.php?id='+object.options[object.selectedIndex].value;
}</script>
This code uses 3 selects - the first is country, the second is semester, and the third is students. I run one php query to get all the students and separate them in group specific <select>s -- this code will show/hide the appropriate <select>s as you select through the country and semester using
onchange="changeCountry(this.form.selectCountry, this.form.selectCountry.options[this.form.selectCountry.selectedIndex].text, this.form);"(the semester selects are named after the country - hence the selectCountry.text)
Then the student selects are named by the combined values of the selected Country and selected Semester. Their onchange code is this:
onchange="goto_URL(this.form['<?php echo $student_group_ID; ?>'])"
Like I said - it works perfectly in Firefox but not at all in IE.