-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate.js
90 lines (66 loc) · 1.89 KB
/
state.js
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
<script type="text/javascript">
document.getElementById("sestate").addEventListener("change", select12);
function select12()
{
//reset municipality select to 0 every time estate is changed
document.getElementById("smunic").selectedIndex=0;
document.getElementById("scity").selectedIndex=0;
//hide when selection has not been made
var n=document.getElementById("smunic");
var d=n.getElementsByTagName("option");
let y;
for (y = 0; y < d.length; y++)
{
d[y].style.display = 'none';
console.log(d[y]);
}
let i=document.getElementById("scity");
let j=i.getElementsByTagName("option");
let k;
for (k = 0; k < j.length; k++)
{
j[k].style.display = 'none';
console.log(j[k]);
}
//display when selection has been made on estate
var e=document.getElementById("sestate").value;
//console.log(e);
let c="e"+e;
//console.log(c);
let a=document.getElementsByClassName(c);
let x;
for (x = 0; x < a.length; x++)
{
a[x].style.display = 'block';
//console.log(a[x]);
}
}
//Select municipality
document.getElementById("smunic").addEventListener("change", select2);
function select2()
{
//reset city select to 0 every time estate is changed
document.getElementById("scity").selectedIndex=0;
//hide when selection has not been made
let p=document.getElementById("scity");
let z=p.getElementsByTagName("option");
let q;
for (q = 0; q < z.length; q++)
{
z[q].style.display = 'none';
//console.log(z[q]);
}
//display when selection has been made on estate
var h=document.getElementById("smunic").value;
//console.log(h);
let c="m"+h;
//console.log(c);
let a=document.getElementsByClassName(c);
let x;
for (x = 0; x < a.length; x++)
{
a[x].style.display = 'block';
//console.log(a[x]);
}
}
</script>