87,910
社区成员
发帖
与我相关
我的任务
分享
<body>
<form>
<input id="a" type="text" />
<input id="b" type="button" onclick="f()" value="按钮" />
</form>
<script>
function f(){
try{
var aaa = document.getElementById("a").value;
if(aaa == ""){
//throw "第x个异常";
alert("第x个异常")
}
}catch(e){
alert(e);
}
}
</script>
</body>