页面代码
<select id="material2" name="material2" class="easyui-combobox"
style="width:153px">
<option value="0">普通物料</option>
<option value="1" selected>电力电缆</option>
<option value="2">光缆</option>
</select></td>
效果
后台JS
$("#material2").combobox({
onSelect:function(option){
var v = $('#material2').combobox('getValue');
if(v == 0){
window.open('platform/inventory/thresholdList.jsp','_self');
}else if(v == 1){
window.open('platform/inventory/thresholdCableList.jsp','_self');
}else if(v == 2){
window.open('platform/inventory/thresholdOpticalCableList.jsp','_self');
}
}
});
下拉框 id :material2 ,对应的选择事件代码:
$("#material2").combobox({
onSelect:function(option){
var v = $('#material2').combobox('getValue');
alert( "__________"+v); //打印出选择的值的option值
}
});
然后根据选择的值打开对应的页面(切换页面)
if(v == 0){
window.open('platform/inventory/thresholdList.jsp','_self');
}else if(v == 1){
window.open('platform/inventory/thresholdCableList.jsp','_self');
}else if(v == 2){
window.open('platform/inventory/thresholdOpticalCableList.jsp','_self');
}
以前是碰到问题解决就过去了,从来不记,第二次碰到就考脑袋,现在感觉记忆力下降了,所以记下来,还能帮到遇到相同问题的朋友。