window.onerror = function (errMsg, scriptURI, lineNumber, columnNumber, errorObj) { setTimeout(function () { var rst = { "错误信息:": errMsg, "出错文件:": scriptURI, "出错行号:": lineNumber, "出错列号:": columnNumber, "错误详情:": errorObj }; alert('出错了,下一步将显示错误信息'); alert(JSON.stringify(rst, null, 10)); }); };