如何将 console.log()
打印的日志输出到 html 页面中1
2
3
4
5
6
7
8
9
10
11(function () {
var old = console.log;
var logger = document.getElementById('log');
console.log = function (message) {
if (typeof message == 'object') {
logger.innerHTML += (JSON && JSON.stringify ? JSON.stringify(message) : message) + '<br />';
} else {
logger.innerHTML += message + '<br />';
}
}
})();
参考
最近热读
扫码关注公众号,或搜索公众号“温欣爸比”
及时获取我的最新文章
