-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlookup.html
44 lines (40 loc) · 1.28 KB
/
lookup.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
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Occupational Code Lookup</h1>
<select id="csElement">
<option value="soc1980">soc 1980</option>
<option value="soc2010">soc 2010</option>
<option value="noc2011">noc 2011</option>
</select>
<input id="codeElement" type="text"><button type="button" value="lookup" id="lookup">lookup</button>
<table>
<thead>
<tr>
<th>System</th>
<th>Code</th>
<th>Title</th>
<th>Level</th>
<th>Parent</th>
</tr>
</thead>
</table>
</body>
<script type="module">
import x from "./lookup.js"
window.x = x
document.getElementById("lookup").addEventListener("click", () => {
let codingSystem = document.getElementById("csElement").value
let code = document.getElementById("codeElement").value
if (code.length < 1) return
let z = x[codingSystem].lookup(code)
let table = document.querySelector("table")
if (z) {
table.insertRow().innerHTML = `<td>${codingSystem}</td><td>${z.code}</td><td>${z.title}</td><td>${z.Level}</td><td>${z.parent}</td>`
console.log(`${codingSystem}: ${code} ==> `, z.code)
}
});
</script>
</html>