티스토리 뷰
여기 =
에 귀하의 throw
진술에 잘못 포함 된 것 같습니다 .
if(x=="") throw="empty";
그냥 제거하고 시도하십시오.
작동하는 바이올린은 다음과 같습니다 . https://jsfiddle.net/74suvvfq/
도움이 되었기를 바랍니다!
-------------------$("button").click(function() {
try {
var x=document.getElementById("demo").value;
if(x=="") throw "empty";
if(isNaN(x)) throw "not a number";
if(x>10) throw "too high";
if(x<5) throw "too low";
}
catch(err) {
var y=document.getElementById("mess");
y.innerHTML="Error:" + err + ".";
}
});
이것이 도움이되기를 바랍니다.
출처
https://stackoverflow.com/questions/39917098
댓글