調試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?