源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Javascript 学习笔记 错误处理

  • 时间:2020-10-06 05:19 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Javascript 学习笔记 错误处理
Java代码
[u]复制代码[/u] 代码如下:
<html> <head> <title>javascript</title> <script type="text/javascript"> function test(inVal){ try{ inVal=inVal.toUpperCase(); }catch(error){ alert("An exception has occurred.Error was:\n\n"+error.message); } } </script> </head> <body> <input type="button" value="Test" onclick="test(null);"> </body> </html>
[u]复制代码[/u] 代码如下:
<html> <head> <title>javascript</title> <script type="text/javascript"> function test(inVal){ try{ inVal=inVal.toUpperCase(); }catch(error){ alert("An exception has occurred.Error was:\n\n"+error.message); } } </script> </head> <body> <input type="button" value="Test" onclick="test(null);"> </body> </html>
利用firefox的firebug来调bug 引用
[u]复制代码[/u] 代码如下:
<html> <head> <title>javascript</title> <script type="text/javascript"> function test(){ var a=0; console.log("checkpoint 1"); a=a+1; console.log("checkpoint 2"); a=a-1; console.log("checkpoint 3"); a=a.toLowerCase(); console.log("checkpoint 4"); } </script> </head> <body> <input type="button" value="Test" onclick="test(null);"> </body> </html>
在IE中可以添加一个方法 引用
[u]复制代码[/u] 代码如下:
function Console(){ this.log=function(inText){ alert(inText); } } var console=new Console();
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部