首先通过后台funcA()将下拉菜单反显不可修改的数据response到disable.jsp页面,disable.jsp:
<script>
var data1=${result.object.data1};
var data2=${result.object.data2};
var data3=${result.object.data3};
......条件
function setDisable(){
show(data1,data2,data3);
$("#.disable_select_property").attr("disabled",true);
}
</script>
<select class="disable_select_property" id = "object_data1" name="object_data1">
<select class="disable_select_property" id = "object_data2" name="object_data2">
<select class="disable_select_property" id = "object_data3" name="object_data3">
disable.jsp select得到从后台传递过来的数据后,由于被设置为disabled,在页面上将显示灰色,下拉菜单不可下拉显示,只显示传递过来的数据,在将这些数据submit给后台funcB()时,提交是失败的。为了使funcB()能够request到这些数据,在disable.jsp内添加hidden类型的<input>:
<input type="hidden" name="data1" id="data1" value="${result.object.data1}"/>
<input type="hidden" name="data2" id="data2" value="${result.object.data2}"/>
<input type="hidden" name="data3" id="data3" value="${result.object.data3}"/>
然后在funcB()中request submit的数据:
request.getParam("data1");
request.getParam("data2");
request.getParam("data3");