-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexampleerror.html
More file actions
31 lines (31 loc) · 905 Bytes
/
Copy pathexampleerror.html
File metadata and controls
31 lines (31 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!DOCTYPE>
<html>
<head>
<title>Check any error</title>
</head>
<body>
<input type="text" id="demo"/>
<button type="button" onclick=mufuc()>CHECK</button>
<p id="demo1"></p>
<script>
function mufuc()
{
var x;
x=document.getElementById("demo").value;
var message;
message=document.getElementById("demo1");
message.innerHTML="";
try{
if(x=="") throw "enter something";
if(isNaN(x)) throw "enter number";
x=Number(x);
if(x<5) throw "number is low";
if(x>10) throw "numbre is high";
}
catch(err){
message.innerHTML="error of"+err;
}
}
</script>
</body>
</html>