Java代码 复制代码 代码如下: <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:nn"+error.message); } } </script> </head> <body> <input type="button" value="Test" onclick="test(null);"> </body> </html> 复制代码 代码如下: <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:nn"+error.message); } } </script> </head> <body> <input type="button" value="Test" onclick="test(null);"> </body> </html> 利用firefox的firebug来调bug 引用 复制代码 代码如下: <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中可以添加一个方法 引用 复制代码 代码如下: function Console(){ this.log=function(inText){ alert(inText); } } var console=new Console();
推荐阅读
asp(javascript)全角半角转换代码 dbc2sbc
asp全角半角转换函数 flag=-1时进行半角转全角 flag=0时进行半角全角互转 flag=1时进行全角转半角 复制代码 代码如下: <% Function DBC2SBC(Str, flag) Dim i, sStr If Len(Str)<= 0 Then Exit Function DBC2SBC =>>>详细阅读
本文标题:Javascript 学习笔记 错误处理
地址:http://www.17bianji.com/kaifa2/JS/28318.html
1/2 1