problem with IE

Discussion in 'JavaScript' started by asmon, Jul 11, 2009.

  1. #1
    i have the following function

    function setOutput(){
    	if(httpObject.readyState == 4){
    	var select = document.getElementById("category_2");
    	select.options.length = 0;
    		for (i in httpObject.responseXML.getElementsByTagName("category")) {		
    				select.options[select.options.length] = new Option(httpObject.responseXML.getElementsByTagName("name")[i].firstChild.nodeValue, httpObject.responseXML.getElementsByTagName("id")[i].firstChild.nodeValue);	
    		}
    		
        return
    	}
    }
    Code (markup):


    this is the structure of the file i call
    header('Content-Type: text/xml');
    echo "<?xml version=\"1.0\" encoding=\"iso-8859-8-i\" ?>";
    echo "<rss version=\"2.0\">";
    ......
    ......
    ......
    while ($selected = mysql_fetch_array($query)) {
    	echo "<category>";
    	echo "<name> {$selected['name']} </name>";
    	echo "<id> {$selected['id']} </id>";
    	echo "<final> {$selected['final']} </final>";
    	echo "</category>";
    }
    echo "</rss>";
    Code (markup):
    it works fine on firefox but i have that yellow 'error on page' icon whn trying
    to run it on ie.
    it probably has something to do with 'getElementsByTagName' method
    because it gives me no errors if i remove the for loop and changing the new option values into a simple text
     
    asmon, Jul 11, 2009 IP