- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.html
More file actions
Latest commit
61 lines (50 loc) · 1.36 KB
/
Copy patherror.html
File metadata and controls
61 lines (50 loc) · 1.36 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>demo</title>
</head>
<body>
<pid="demo"></p>
<inputtype="text" value="" id="fld" />
<buttononclick="btn()">Click</button>
<pid="demo2"></p>
<pid="demo3"></p>
<script>
try{
adddalert('Hello');
}
catch(test){
document.getElementById('demo').innerHTML=test.message;
}
functionbtn(){
vartxV=document.getElementById('fld').value;
try{
if(txV=='')throw'Fill the text box';
if(isNaN(txV))throw'not a number';
if(txV>20)throw'give low number';
if(txV<5)throw'give high number';
}
catch(errMsg){
document.getElementById('demo2').innerHTML=errMsg;
}
finally{
document.getElementById('fld').value='';
}
}
/*function btn(){
var fldV = document.getElementById('fld').value;
try {
if(fldV == '') throw 'Fill text';
if(isNaN(fldV)) throw 'not number';
fldV = Number(fldV);
if(fldV < 5) throw 'too low';
if(fldV > 15) throw 'too high';
}
catch (err){
document.getElementById('demo2').innerHTML = err;
}
}*/
</script>
</body>
</html>