Created
April 2, 2011 07:50
-
-
Save songpp/899317 to your computer and use it in GitHub Desktop.
javascript window onerror function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onerror = function() { | |
/** | |
* onerror 事件 | |
* arguments 共三个 | |
* | |
* 第一个 错误原因 | |
* 第二个 所在js文件 | |
* 第三个 第几行 | |
*/ | |
arglen = arguments.length; | |
var errorMsg = "参数个数:" + arglen + "个"; | |
for ( var i = 0; i < arglen; i++) { | |
errorMsg += "\n参数" + (i + 1) + ":" + arguments[i]; | |
} | |
alert(errorMsg); | |
}; | |
sdfsdfa; | |
function t(){ | |
t; | |
} | |
t(); | |
try { | |
var x = parseFloat(tt); | |
alert(typeof(x)); | |
} catch (e) { | |
alert(typeof (e)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment