1) 为什么在 IE 8 中typeof(window["alert"]) 是 "object" 而不是函数?
2)如何在“window.alert”上调用应用方法?我的意思是我想要做的是:
function exec(method, param)
{
//because of typeof(window["alert"]) == "object" the actual if looks like typeof(window[method]) == 'function' || method == 'alert'
if(typeof(window[method]) == 'function')
{
window[method].apply(window, [param]);
}
}
exec("alert","hello");