-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist.html
83 lines (47 loc) · 1.38 KB
/
list.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
</head>
<script>
var ddllist = [
{nm:"1",no:"11" ,id:"111"},
{nm:"1",no:"11" ,id:"112"},
{nm:"1",no:"11" ,id:"113"},
{nm:"4",no:"44" ,id:"411"},
{nm:"4",no:"44" ,id:"412"}
];
function myFunction(){
let exists={};
let result=[];
ddllist.forEach((el)=>{
if(!exists[el.no]) {
exists[el.no]=true;
result.push({Type: el.nm, TypeName: el.no});
document.getElementById('ddl').options.add(new Option(el.nm,el.no));
}
});
//alert('zzz');
}
function myFunction2(){
document.getElementById("dd2").innerHTML = "";
ddllist.forEach((el)=>{
if(el.no == document.getElementById('ddl').value){
document.getElementById('dd2').options.add(new Option(el.id,el.id));
}
});
}
</script>
<body >
<select id="ddl" onchange="myFunction2()" ></select>
<select id="dd2" ></select>
<input type="button" id="myBtn" onclick="myFunction()" value=" 執行 "
<pre id="demo"></pre>
</body>
</html>