jsp中单选按钮值的读取
<%@pagecontentType="text/html;charset=gb2312"%><html><head><scriptlanuage="javaScript...
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<script lanuage="javaScript">
</script>
</head>
<body>
<form name="myform">
<p>性别
</p>
<input type=radio name=aa value="aa" checked>男
<input type=radio name=aa value="bb">女
input type="submit" name="submit" value="提交" />
</form>
</body>
</html>
如何能通过JAVASCRIPT使点击提交按钮后出现“性别”+所选性别的结果 展开
<html>
<head>
<script lanuage="javaScript">
</script>
</head>
<body>
<form name="myform">
<p>性别
</p>
<input type=radio name=aa value="aa" checked>男
<input type=radio name=aa value="bb">女
input type="submit" name="submit" value="提交" />
</form>
</body>
</html>
如何能通过JAVASCRIPT使点击提交按钮后出现“性别”+所选性别的结果 展开
2个回答
展开全部
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<script type="text/javascript">
function getSex()
{
var sex=document.getElementsByTagName("input");
for(var i=0;i<sex.length;i++)
{
if(sex[i].type=="radio"&&sex[i].checked)
alert(sex[i].value)
}
}
<蚂灶或闷伍/script>
</head>
<body>
<form name="myform" onSubmit="辩橘getSex()">
<p>性别
</p>
<input type="radio" name="aa" value="男" checked>男
<input type="radio" name="aa" value="女">女
<input type="submit" name="submit" value="提交" />
</form>
</body>
</html>
<html>
<head>
<script type="text/javascript">
function getSex()
{
var sex=document.getElementsByTagName("input");
for(var i=0;i<sex.length;i++)
{
if(sex[i].type=="radio"&&sex[i].checked)
alert(sex[i].value)
}
}
<蚂灶或闷伍/script>
</head>
<body>
<form name="myform" onSubmit="辩橘getSex()">
<p>性别
</p>
<input type="radio" name="aa" value="男" checked>男
<input type="radio" name="aa" value="女">女
<input type="submit" name="submit" value="提交" />
</form>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询