Skip to content

Instantly share code, notes, and snippets.

@songpp
Created April 2, 2011 07:50
Show Gist options
  • Save songpp/899317 to your computer and use it in GitHub Desktop.
Save songpp/899317 to your computer and use it in GitHub Desktop.
javascript window onerror function
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