Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returned values writing to object in FF, not IE

Status
Not open for further replies.

travisbrown

Technical User
Joined
Dec 31, 2001
Messages
1,016
I'm dynamically calling the options for a select. Works in FF, but in IE it won't write the innerhtml. Looks like the values are coming back all right; I can alert the returned values right up to the innerhtml command, just leaves the select with no options. Doesn't seem to raise any errors in IE or FF.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function createRequestObject() {
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
		//ro = new ActiveXObject("Msxml2.XMLHTTP");
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		ro = new XMLHttpRequest();
	}
	return ro;
}

var http = createRequestObject();

function testReq(action,change) {
	//alert(action)
    http.open('get', 'inc_lmcc_trades.asp?action=' + action );
    http.onreadystatechange = function(){
		if(http.readyState == 4){
        var response = http.responseText;
		//alert(response)
		//alert(change)
        document.getElementById( change ).innerHTML = response;
		}	
	}
    http.send(null);
}


function filterList(theElement){
	if (document.getElementById( theElement ).value == 0){
	testReq(0,theElement);
	}
	else if(document.getElementById( theElement ).value == -1){
	testReq(1,theElement);
	}
};

-->
</script>
</head>
<body>
<!-- BEGIN ITEM -->
  <select id="lmcctrades" name="trades_0" onchange="filterList(this.id)">
    <option value="34">ABSU Call Centre</option>
    <option value="73">Apparatus Tester</option>
    <option value="38">Backhoes</option>
    <option value="54">Cable Splicer</option>
    <option value="96">Cable Splicer - Apprentice</option>
    <option value="47">Civil Inspectors</option>
    <option value="56">CPC</option>
    <option value="51">Designer</option>
    <option value="58">Disconnect/Reconnect</option>
    <option value="93">Distribution Operations Manager</option>
    <option value="0">< Show All ></option>
  </select>
<!-- END ITEM -->
</body>
</html>

inc_lmcc_trades.asp is just other options, nothing else.
 
what are the values that you see being alerted?

-kaht

[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
[banghead]
 
the id of the target object: (lmcctrades) and the response html: <option value="n">...</option>

I'm alerting them right before the innerhtml command.

//alert(response)
//alert(change)
document.getElementById( change ).innerHTML = response;
 
This is what is being called and returned as the response variable

Code:
<option value="34">ABSU Call Centre</option>
<option value="73">Apparatus Tester</option>
<option value="38">Backhoes</option>
<option value="54">Cable Splicer</option>
<option value="96">Cable Splicer - Apprentice</option>
<option value="47">Civil Inspectors</option>
<option value="56">CPC</option>
<option value="51">Designer</option>
<option value="58">Disconnect/Reconnect</option>
<option value="93">Distribution Operations Manager</option>
<option value="0">- Show All -</option>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top