调试JavaScript错误
作者:Eve Cole
更新时间:2010-08-08 09:43:28
<script type="text/javascript">
view sourcePRint?1 function myerror(_message,_url,_line) {
view sourceprint?1 alert("错误信息:" + _message +"n错误的URI:" + _url +"n错误的行数:" + _line );
show sourceview sourceprint?1 return true; //屏蔽系统的事件
show sourceview sourceprint?1 }
show sourceview sourceprint?1 //绑定错误事件
show sourceview sourceprint?1 window.onerror = myerror;
show sourceview sourceprint?1 //触发错误示例:
show sourceview sourceprint?1 window,onload = test;
show sourceview sourceprint?