innerHTML是NULL或不是对象IE javascript错误

时间:2011-10-24 10:17:41

标签: javascript internet-explorer

我在IE浏览器中遇到了很多麻烦,但我无法解决这个问题。我没有在IE中显示任何东西,但它适用于Firefox。它抛出了一个错误, 'innerHTML'为NULL或不是对象 。 这是javascript函数:

function culege_date() // se trimit hotelurile selectate pentru a prelua preturile
{
    var selectii = "";
    var a = document.getElementsByName("id_booking.com");
    var b = document.getElementsByName("radio3");
    var data = document.getElementById("data"); // se preia data din select
    for(var i = 0; i < b.length; i++)
    {
        if(b[i].checked==true)
        selectii += a[i].innerHTML + "_"; // se preia id-ul hotelurilor selectate
    }           
    if (window.XMLHttpRequest) // se trimite request-ul
        xmlhttp=new XMLHttpRequest();
    else
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange=function()
    {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)// readystate==4 pagina e incarcata complet; status=200 OK (404 not found)
            document.getElementById("rezultate").innerHTML=xmlhttp.responseText; // returneaza raspunsul ca si string
    }
    xmlhttp.open("GET","load.php?select="+selectii+"&data="+data.value,true);//se face linkul si se scot datele 
    xmlhttp.send();             
}

0 个答案:

没有答案