1、代码 try{ 执行代码块 }catch(err){ //异常信息 alert(err); //抛出异常 if(err=='004') throw("密码错误"); } 转载于:https://www.cnblogs.com/yqlog/p/5545516.html