-
Notifications
You must be signed in to change notification settings - Fork 0
/
dom.html
93 lines (53 loc) · 1.47 KB
/
dom.html
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
<!--DOM - Document Object model
The document object represent the whole html document.
when the document is loaded in the browser it becomes document object.
fatch value using predefine functions that are -
1)document.getElementById()
2)document.getElementBy
-->
<!--fatch value with out using predefine function-->
<!--
<form name="form">
Enter Your Name<input type="name" placeholder="Enter Your Name" name="name">
<input type="submit" name="" value="Submit" onclick="abc()">
</form>
-->
<form name="form2">
Username:<input type="name" name="name">
Password:<input type="Password" name="password">
<input type="submit" value="submit" name="" onclick="abcd()">
</form>
<script type="text/javascript">
function abcd(){
var user = document.form2.name.value;
var pass = document.form2.password.value;
if (user=="" || user=="null") {
if (pass=="null" || pass=="") {
alert("UserName & Password can't be blank.");
}
else{
alert("UserName can't be blank");
}
}
else if (pass=="" || pass=="null"){
alert("password can't be blank");
}
else if (pass.length<8){
alert("password must be eight characters");
}
else{
alert("submitted successfully");
window.open("https://www.google.com");
}
}
</script>
</body>
</html>