<html>
<head>
<script>
var x = prompt("Enter a number between 0 and 10:"," ");
try{
if(x>10 ) throw "err1";
else if(x<0 )throw "err2";
}catch(err){
if(err=="err1") alert("Error! The value is too high");
if(err=="err2") alert("Error! The value is too low");
}
</script>
</head>
<body>
</body>
</html>
throw 抛出异常
最新推荐文章于 2023-08-07 09:15:43 发布