读书人

获取html:radio的值单选按钮js获得

发布时间: 2012-11-10 10:48:50 作者: rapoo

获取html:radio的值,单选按钮,js取得struts标签的值
<html:form action="/KK_BlacklistVehicle_UserManage.do" method="post">

<html:radio name="KK_BlacklistVehicle_UserManageForm" property="radio" value="emailRadio">邮箱:</html:radio>
<html:text property="dwcxInput" />
<html:radio name="KK_BlacklistVehicle_UserManageForm" property="radio" value="mobilRadio">短信:</html:radio>
<html:text property="usercxInput" />

<html:button property="selectDwUser" onclick="selectDwUserJs();">查询</html:button>
</html:form>

function selectDwUserJs()
{
var objs = document.getElementsByName("radio");
for(var i=0;i<objs.length;i++)
{
if(objs[i].checked)
{
if(objs[i].value=="emailRadio")
{
alert("你选择了邮箱");
}
if(objs[i].value=="mobilRadio")
{
alert("你选择了手机短信");
}
}
}
document.forms[0].action='KK_BlacklistVehicle_UserManage.do' ;
document.forms[0].submit();
}

读书人网 >CSS

热点推荐