-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy path26-forms.html
More file actions
36 lines (31 loc) · 996 Bytes
/
26-forms.html
File metadata and controls
36 lines (31 loc) · 996 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
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Demo</title>
<script type="text/javascript">
var checkForm = function() {
if (document.myForm.theBox.checked) {
alert('You Win!');
} else {
alert('Oops!');
}
}
</script>
</head>
<body>
<!--
when creating a form, JS already creates the necessary form object(s)
each form in a view is actually listed into an array
-->
<form name="myForm">
<label>username: </label>
<input type="text" name="usersName" />
<label>password: </label>
<input type="password" name="usersPassword" />
<input type="checkbox" name="theBox"/>
<input type="button" onClick="checkForm()" type="submit" value="Click me" />
</form>
</body>
</html>