首页 >web前端 >js教程 >调试代码导致IE出错的避免方法_javascript技巧

调试代码导致IE出错的避免方法_javascript技巧

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-05-16 16:53:331038浏览
复制代码 代码如下:

if(!window.console){
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml","group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

window.console = {};
for (var i = 0; i window.console[names[i]] = function() {};
}
}

可以放在基础库里面,当然,注意names和i的作用域~
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn