Javascript 错误处理:try throw catch
来源:互联网 发布:union mysql性能级别 编辑:程序博客网 时间:2024/06/05 00:44
<body> <p>请输入1~10的数字:</p> <input id="input" type="text" onfocus="clearAll(this)"> <input type="button" value="校验" onclick = "check()"> <p id="msg"></p></body>
<script> function check(){ try{ var x = document.getElementById("input").value; if(x==""){throw "值为空!";} if(isNaN(x)){throw "不是数字!";} if(x<1){throw "数字太小!";} if(x>10){throw "数字太大!";} } catch(error){ var y = document.getElementById("msg"); y.innerHTML = "错误:" + error ; } } function clearAll(x){ x.value=""; }</script>
0 0
- Javascript 错误处理:try throw catch
- JavaScript错误-Throw Try Catch
- JavaScript--JavaScript 错误 - Throw、Try 和 Catch
- JavaScript 错误 - Throw、Try 和 Catch
- JavaScript 错误 - Throw、Try 和 Catch
- JavaScript 错误 - Throw、Try 和 Catch
- JavaScript 错误 - Throw、Try 和 Catch
- JavaScript 错误 - throw、try 和 catch
- JavaScript 错误 - Throw、Try 和 Catch
- JavaScript错误-throw、try{ } catch(err){ }
- JavaScript 1.7 错误try catch throw
- JavaScript 错误 – Throw、Try 和 Catch
- JavaScript try...catch throw
- JavaScript try-catch-throw
- 【JavaScript】错误处理:try......catch
- JavaScript基础1:JavaScript 错误 - Throw、Try 和 Catch
- try catch throw异常处理
- 异常处理 throw try catch
- 使用GitHub对代码进行版本控制、托管
- java银行卡类的部分编写 含异常运用
- maven项目导入IntelliJ IDEA后,是怎么下载jar包到本地的?即InteliJ Idea怎么导入maven工程?
- WWDC2016 Session笔记 - iOS 10 UICollectionView新特性
- Hadoop_HDFS_hdfs 文件系统操作指令
- Javascript 错误处理:try throw catch
- 如何加速推送SCCM Agent到客户端机器
- iOS UIWebView 的下拉刷新和上拉加载的实现
- 神经网络中激活函数比较
- 半杯水
- Unity使用Random对数组随机排序
- corosync+pacemaker实现openstack HA(二)
- Java-理解static
- Andriod 内存泄露问题的整理