控制台呢?登录IE8?根据这个职位它在测试版里,但不在发行版里?
3 回答
Cats萌萌
TA贡献1805条经验 获得超9个赞
var alertFallback = true; if (typeof console === "undefined" || typeof console.log === "undefined") { console = {}; if (alertFallback) { console.log = function(msg) { alert(msg); }; } else { console.log = function() {}; } }
慕桂英4014372
TA贡献1871条经验 获得超13个赞
function trace(s) { if ('console' in self && 'log' in console) console.log(s) // the line below you might want to comment out, so it dies silent // but nice for seeing when the console is available or not. else alert(s)}
function trace(s) { try { console.log(s) } catch (e) { alert(s) }}
添加回答
举报
0/150
提交
取消