XML DOM 在IE8上有問題

本帖最後由 CHK 於 2012-8-2 11:55 編輯

為甚麼會RUN唔到?其他BROWSER正常
說紅色那行有問題

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET4.0C; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Thu, 2 Aug 2012 03:08:02 UTC


Message: Unknown runtime error
Line: 26
Char: 3
Code: 0
URI: http://10.144.151.18:8081/test/test1/j_customercode.js


Message: Object expected
Line: 1
Char: 1
Code: 0
URI: http://10.144.151.18:8081/test/test1/


Message: Unknown runtime error
Line: 26
Char: 3
Code: 0
URI: http://10.144.151.18:8081/test/test1/j_customercode.js


Message: Object expected
Line: 1
Char: 1
Code: 0
URI: http://10.144.151.18:8081/test/test1/

var xmlHttp

function showUser(str)
{
        xmlHttp=GetXmlHttpObject()
        if (xmlHttp==null)
        {
                alert ("Browser does not support HTTP Request")
                return
        }
var url="j_customercode.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
//xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged()
{
        if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
        {       
                xmlDoc=xmlHttp.responseXML;
                var CustomerName = document.getElementById("CustomerName")
                document.getElementById("CustomerName").value=CustomerName.innerHTML=
                xmlDoc.getElementsByTagName("CustomerNameShow")[0].childNodes[0].nodeValue;
               
                var Discount = document.getElementById("Discount")
                document.getElementById("Discount").value=Discount.innerHTML=
                xmlDoc.getElementsByTagName("DiscountShow")[0].childNodes[0].nodeValue;
               
                var Billto = document.getElementById("Billto")
                document.getElementById("Billto").value=Billto.innerHTML=
                xmlDoc.getElementsByTagName("BilltoShow")[0].childNodes[0].nodeValue;
        }
}

function GetXmlHttpObject()
{
        var objXMLHttp=null
        if (window.XMLHttpRequest)
        {
                objXMLHttp=new XMLHttpRequest()
        }
        else if (window.ActiveXObject)
        {
                objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
        }
        return objXMLHttp
}