2. javascript
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
|
第一個下拉
<td width="126">
<select name="searchFirst" id="searchFirst" onchange="selectChange()">
<option name="searchmaxid" value="-1">--請選擇--</option>
<c:forEach items="${requestScope.mcType}" var="first">
<c:if test="${first.npid==0}">
<option name="smaxid" value="${first.nid}">${first.sname }</option>
</c:if>
</c:forEach>
</select></td>
第二個下拉
<td width="95">
<select name="searchSecond" value="${param.searchSecond}">
<option name="serachminid" value="-1">--請選擇--</option>
</select>
</td>
方法:function selectChange(){
var second_npid=document.getElementById("searchSecond");
searchForm.searchSecond.options.length=1;
var first_nid=document.getElementById("searchFirst").value;
for(i=0;i<${j};i++){
if(array_2[i].npid==first_nid){
searchForm.searchSecond.options.add(new Option(array_2[i].sname,array_2[i].nid));
}
}
|