Jump to content

working in firefox but not in ie 6/7??


LoOpy

Recommended Posts

ok now this script below is dynamicaly changing the option for the select its working perfectly in firefox 2 but not in ie 6 or 7 which sux am i missing a setting in ie or do i need to change the script??

 

this script abit dirty but im new to ajax so any simplification would be welcome.

 

hope everything clear....

 

select 1

<select id="source" name="source" onChange="sourceSelect(this.options[this.selectedIndex].value);">
<option> Select </option>
<option >Online</option>
<option >Print</option>
<option >Video</option>
</select>

select 2

<select name="sourceType" id="sourceType" />
<option> Empty </option>
</select>

 

function

function getHTTPObject(){
if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) return new XMLHttpRequest();
else {
	alert("Your browser does not support AJAX.");
	return null;
}
var xmlHttp=null;
}

function sourceSelect(selectedValue){
	var typeArray = ''; 
	var x = Array(); //gen array
	var v = ''; //var
	document.getElementById('sourceType').options.length = 0;
	var req = getHTTPObject();	
	req.open('GET', 'includes/ajax.php?name='+selectedValue, true);
	req.onreadystatechange = function (aEvt) {
		if (req.readyState == 4) {
			typeArray = req.responseText;
			x = typeArray.split(',');
			for (v in x){
				document.getElementById('sourceType').options[v] = new Option(x[v],x[v]);
			}	
		}			
	};		
	req.send(null);
}var req = null;

 

ajax.php queries database which returns string to function

echo 'Select,opj1,obj2,obj3';

Link to comment
https://forums.phpfreaks.com/topic/90660-working-in-firefox-but-not-in-ie-67/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.