jsp 实现二级联动
选择一个下拉框后,在一个div里显示该项目的内容,我第一次点击已经可以了,但是之后再选择其他的,div列表不再刷新,调试显示到div的页面内容是正确的,大家帮忙看看,代码如下:
<div>
<table width="100%" height="300px" cellpadding="0" cellspacing="0">
<tr><td> 项目类别:</td>
<td height="25">
<select id="itemType" onchange="setItemType();">
<option value="" desc=""></option>
<%for(int i=0;SysCode.sysTypeList!= null && i<SysCode.sysTypeList.size();i++){
CrrtSysDict crrtsysdic= (CrrtSysDict)SysCode.sysTypeList.get(i); %>
<option value="<%=StringUtil.toHtml(SysCode.sysTypeList.get(i).getItemCode()) %>"> <%=StringUtil.toHtml(SysCode.sysTypeList.get(i).getItemName()) %>
</option> <%} %></select></td>
</tr>
<tr><td colspan="2">
<table width="100%" height="100%" cellpadding="0" cellspacing="0">
<tr><td width="45%">
<div id="leftList" class="body_area_main">
</div>
</td>
<script defer="defer">
function setItemType(){ //查询结果项目类型下拉框选择事件
var selectIndex = document.getElementById("itemType").selectedIndex;
if(selectIndex>-1){
//document.all.itemType.options.length = 0; //清空表单
var itemType = document.getElementById("itemType").options[selectIndex].value;
var url = "<%=urlStart%>&reqType=ItemType&itemType="+itemType;
document.getElementById("itemType").value = locationid;
var str =doGet(url,null,false);
document.all.leftList.innerHTML = "";
document.all.leftList.innerHTML = str;
alert(str);
}
}
</script>