2012-04-14 30 views
0

我有一個我正在使用的ajax日曆,它在Chrome瀏覽器中工作正常,Safari瀏覽器像往常一樣使用Firefox &。但它不能在IE9或更低版本中運行。SCRIPT 600:此操作的目標元素無效。 (IE Only)

我收到以下錯誤SCRIPT 600:此操作的目標元素無效。

這是一個WP插件,但這是代碼

function show_micro_ajax(response) { 
    document.getElementById('wp-calendar').innerHTML = response; 
} 

function microAjax(url, cF) { 
    this.bF = function(caller, object) { 
     return function() { 
      return caller.apply(object, new Array(object)); 
     } 
    }; 
    this.sC = function(object) { 
     if (this.r.readyState == 4) { 
      this.cF(this.r.responseText); 
     } 
    }; 
    this.gR = function() { 
     if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP'); 
     else if (window.XMLHttpRequest) return new XMLHttpRequest(); 
     else return false; 
    }; 
    if (arguments[2]) this.pb = arguments[2]; 
    else this.pb = ""; 
    this.cF = cF; 
    this.url = url; 
    this.r = this.gR(); 
    if (this.r) { 
     this.r.onreadystatechange = this.bF(this.sC, this); 
     if (this.pb != "") { 
      this.r.open("POST", url, true); 
      this.r.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 
      this.r.setRequestHeader('Connection', 'close'); 
     } else { 
      this.r.open("GET", url, true); 
     } 
     this.r.send(this.pb); 
    } 
}​ 

回答

0

如果你沒有支持IE6,刪除的ActiveX線, 否則,扭轉測試:

if (window.XMLHttpRequest) return new XMLHttpRequest(); 
    else if (window.ActiveXObject) return new ActiveXObject('Microsoft.XMLHTTP'); 
    else return false; 

我不確定實例如何成爲這裏的數組, 並且可能IE也不會,特別是如果其中一個成員在sn ActiveX對象中。

return caller.apply(object, new Array(object))