<BODY>
<select name= "gpr" id= "gpr" onchange= "change(this.value)" >
<option value= "1" >班级1
<option value= "2" >班级2
<option value= "3" >班级3
<option value= "4" >班级4
<option value= "5" >班级5
</select>
<SCRIPT LANGUAGE= "JavaScript" >
<!--
var x = '3' ; //这个是上次选中的值,你应该放到request中返回的时候可以取到
var sel = document.getElementById( 'gpr' );
for ( var i=0;i<sel.options.length;i++){
if (sel.options[i].value==x){
sel.options[i].selected= true ; break ;
}
}
function change(pm){
//submit form
}
//-->
</SCRIPT>
</BODY>
// 设置页面Select对象的选中状态
function getSelectState(selectId, optionValue){
var sel = document.getElementById(selectId);
for ( var i=0;i<sel.length;i++) {
if (sel.options[i].value == optionValue) {
sel.selectedIndex = i;
break ;
}
}
}
// 使用
$(document).ready( function (){
// 要设置的Select的id
getSelectState( "id" , "${param.id}" );
});
|