This repository was archived by the owner on Mar 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayground.html
More file actions
44 lines (44 loc) · 1.52 KB
/
playground.html
File metadata and controls
44 lines (44 loc) · 1.52 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
<html>
<head>
<title>Javascript Demo</title>
<script>
function addEmployee(name, job){
var row = "<tr><td>"+name+"</td><td>"+job+"</td></tr>";
document.getElementById('employees').innerHTML += row;
}
function add(){
var employee = new Object();
employee.name = document.getElementById("employee-name").value;
employee.job = document.getElementById("job-title").value;
addEmployee(employee.name, employee.job);
}
</script>
<style type="text/css">
.centerDiv{
position: absolute;
top: 0%;
height: 200px;
margin-top: 0px; /* Half of the height */
left: 100%;
width:200px;
margin-left: -250px; /* Half of the width */
border-radius: 5px;
background:#ccc;
padding:10px;
}
</style>
</head>
<body>
<div id = "centerDiv" class = "centerDiv">
<form name="new-employee">
Name: <input type="text" id="employee-name"><br />
Title: <input type="text" id="job-title"><br />
<input type='button' onclick='add()' value='Submit Employee'/>
</form>
</div>
<table>
<thead><tr><td>Name</td><td>Job Title</td></tr></thead>
<tbody id="employees"></tbody>
</table>
</body>
</html>