在Internet Explorer 10,我有以下幾點:無效的調用對象,兼容性
/*
* Alias document.getElementById(), to reduce typing, improve
* readability and speed up access to the function.
*/
var getElmById = document.getElementById;
function . . . (ctlID) {
var ctrl = getElmById(ctlID); // <————<<< error raised here
. . .
}
這一直工作正常,但突然是給我
SCRIPT65535: Invalid calling object
我已經確定如果我選中框Tools > Compatibility View Settings > [_] Display intranet sites in Compatibility View
,別名功能運行得很好,但是如果我清除該框,則會出現錯誤。
是什麼原因? IE正在響應的具體問題是什麼?像這樣的混疊功能被消除了嗎? 「文檔」對象的行爲方式是否有所改變?
這個主題有一個優秀的解釋: http://stackoverflow.com/questions/1007340/javascript-function -aliasing-doesnt-scost-to-work – 2015-02-05 19:24:37