Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
132 lines (115 loc) · 2.69 KB
/
Copy pathindex.html
File metadata and controls
132 lines (115 loc) · 2.69 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CPIT405 - JavaScript and DOM</title>
<style>
table.striped {
width: 500px;
border-spacing: 0;
}
table.striped th, table.striped td {
padding: 5px;
}
table.striped thead {
background-color: #78BCFE;
}
table.striped thead th {
color: #FFF;
}
table.striped tbody tr th, table.striped tbody tr td {
border-bottom: 1px solid #ccc;
}
table.striped tbody tr:nth-child(even) {
background-color: #fff9e6;
}
td input[type=text],
td input[type=email] {
width: 100%;
box-sizing: border-box;
}
.right {
text-align: right;
}
.left {
text-align: left;
}
.center {
text-align: center;
}
</style>
</head>
<body>
<h2>Add To Address Book</h2>
<form action="#not-implemented" method="post" id="contact-form">
<table class="striped">
<tbody>
<tr>
<td class="right">
<label for="name-field">Name</label>
</td>
<td>
<input type="text" name="name" id="name-field">
</td>
</tr>
<tr>
<td class="right">
<label for="email-field">Email</label>
</td>
<td>
<input type="email" name="email" id="email-field">
</td>
</tr>
<tr>
<td class="right">
<label for="mobile-field">Mobile</label>
</td>
<td>
<input type="tel" name="mobile" id="mobile-field">
</td>
</tr>
<tfoot>
<tr>
<td>
</td>
<td class="right">
<input type="button" value="Add To Table">
<!--<input type="submit" value="Add To Table">-->
</td>
</tr>
</tfoot>
</tbody>
</table>
<br>
</form>
<h2>Address Book</h2>
<table class="striped">
<thead>
<tr>
<th>#</th>
<th class="left">Name</th>
<th class="left">Email</th>
<th class="center">Mobile</th>
<th>Option</th>
</tr>
</thead>
<tbody id="info-list">
</tbody>
</table>
<script type="text/javascript">
var main_form, text_name, text_email, text_mobile, btn, output;
window.onload = function () {
main_form = document.querySelector('#contact-form');
text_name = document.querySelector('input[name=name]');
text_email = document.querySelector('input[name=email]');
text_mobile = document.querySelector('input[name=mobile]');
btn = document.querySelector('input[type=button]');
output = document.querySelector('#info-list');
btn.addEventListener('click', add_handler);
// main_form.addEventListener('submit', add_handler);
};
</script>
<script src="js/contacts.js" type="text/javascript"></script>
</body>
</html>