您的位置:首页 > 其它

用脚本实现据radio是否checked对action进行更改,从而达到更新目的

2007-11-18 22:55 369 查看
星期五 2007年03月16日

用脚本实现据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" onclick="javascript:refreshtype()" <%if (checktype==0) out.println("checked=/"checked/"");%> >类型0
<input type="radio" name="check_type" value="1" onclick="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进行更改,从而达到更新目的.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐