6
可能重複:
JavaScript function aliasing doesn't seem to workJavaScript的:通過局部變量引用主機功能
爲什麼不這項工作?
function foo() {
var g = document.getElementById;
g('sampleID');
}
這個錯誤被拋出在Chrome:Uncaught TypeError: Illegal invocation
...並在Firefox:Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object"
它工作在IE9測試版雖然!!
可能重複[JavaScript函數混淆似乎並沒有工作(HTTP://計算器。 com/questions/1007340/javascript-function-aliasing-doesnt-seem-to-work) – 2011-02-06 23:13:37
你有沒有試過,`g.call(document,'sampleID');`? – Pointy 2011-02-06 23:16:26