用脚本实现据radio是否checked对action进行更改,从而达到更新目的
<%
var checktype = 0;
%>
<form name="check_form" id="check_form" action="" method="POST" >
<tr>
<td height="35" colspan="2" bgcolor="#D4D3CE" >请选择类型
<input type="radio" name="check_type" value="0" οnclick="javascript:refreshtype()" <%if (checktype==0) out.println("checked=/"checked/"");%> >类型0
<input type="radio" name="check_type" value="1" οnclick="javascript:refreshtype()" <%if (checktype==1) out.println("checked=/"checked/"");%> >类型1
</td>
</tr>
<form>
<script type="" language="javascript">
function refreshtype(){
var radios = document.check_form.check_type;
var checkedtype;
for (var i=0; i < radios.length; i++){
if (radios[i].checked){
checkedtype = radios[i].value; break;
}
}
//测试
alert("类型"+checkedtype);
document.getElementById("check_form").action = "<%=request.getContextPath()%>/Manage.do?method=show&Type="+checkedtype;
document.getElementById("check_form").submit();
return true;
}
</script>
根据radio是否checked对action进行更改,从而达到更新目的.