hi guys I have the following code that works fine in all browsers but all IE versions. When I select an option from the first drop down the second one is to be dynamically populated by details based on the first selection. Unfortunately in IE the second dropdown shrinks and nothing is displayed.
the alert(res) on the function onChangeAgentRegion1 function below displays the options attached but I think IE is unable to render this. Please any ideas
[U][B]Ajax code[/B][/U]
function GetXmlHttpObject() {
var xmlhttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlhttp=new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlhttp;
}
function onChangeAgentRegion1()
{
var w = document.agent.agentregion.selectedIndex;
var selected_text = document.agent.agentregion.options[w].id;
//alert(selected_text);
document.agent.agentsubregion.enabled = true;
document.getElementById('agentsubregion').innerHTML='<option>Loading...</option>';
var xmlhttp=GetXmlHttpObject();
if (xmlhttp==null) {
alert ("Your browser does not support AJAX!");
return;
}var date=new Date();
var timestamp=date.getTime();
var url="process.php";
var param="region_id="+selected_text+"×tamp="+timestamp;
//alert(param);
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 || xmlhttp.readyState=="complete")
{
var res=xmlhttp.responseText;
// alert(res);
document.getElementById('agentsubregion').innerHTML=res;
}
}
xmlhttp.open("POST",url,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlhttp.setRequestHeader("Content-length", param.length);
xmlhttp.setRequestHeader("Connection", "close");
xmlhttp.send(param);
//alert("45678");
}
[U][B]php code[/B][/U]
<tr>
<td class="style66" width="179" valign="top">Agent Region(Head Office) </td>
<td width="354" class="style64" valign="top">
<div >
<select name = "agentregion" id="agentregion" onchange="onChangeAgentRegion1();" class="style71" <?php echo $status;?>>
<option value="" selected>---Select Region ----</option>
<?php
getRegions($_SESSION['reg']);
?>
</select>
</div>
</td>
</tr>
<tr>
<td class="style66" width="179" valign="top">Agent Sub - Region </td>
<td width="354" class="style64" valign="top"><div align="left">
<select name = "agentsubregion" id="agentsubregion" class="style71" >
<option value="" selected>---Select Sub-Region ----</option>
<?php
getSubRegions($_SESSION['reg']);
?>
</select>
</div></td>
</tr>