如何获取被选中的radio的值

kingwm 2008-10-19 04:22:13
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
-->
</style>
</head>

<body>
<form action=2.asp?K6=K10 method="post">
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="1">
<tr>
<td align="center" bgcolor="#FFFF00">PCBA</td>
<td align="center" bgcolor="#FFFF00"><span class="STYLE3">PCB</span></td>
<td align="center" bgcolor="#FFFF00"><span class="STYLE3">HIC</span></td>
<td align="center" bgcolor="#FFFF00">单元基板</td>
</tr>
<tr>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V1号'" name="zm" type="radio" value="P1" <%if zm="P1" then%>checked<%end if%> /></td>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V2号'" type="radio" name="zm" value="P2" <%if zm="P2" then%>checked<%end if%> /></td>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V3号'" type="radio" name="zm" value="P3" <%if zm="P3" then%>checked<%end if%> /></td>
<td align="center"><input type="radio" onclick="window.location.href='rate_zmt.Asp?zm=V4号'" name="zm" value="P4" <%if zm="P4" then%>checked<%end if%> /></td>
</tr>
<tr>
<td align="center" colspan="4"><INPUT type=submit value=提交 name=submit>
</table>
</form>
<form action=2.asp?K6=K13 method="post">
<table border="1">
<tr><td align="center"><INPUT type=submit value=提交2 name=submit></td>
</tr>
</table>
</form>

<in>
</body>
</html>


2.asp源码如下:
Select Case Request("K6")
Case "K10"
K10
Case "K13"
K13
Case Else
Response.Write ("<script language=javascript>history.go(-1)</script>")
Response.End
End Select
SUB K13
下面该怎么写才能获取ZM的值?




谢谢!
...全文
194 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingwm 2008-10-19
  • 打赏
  • 举报
回复
有没有其实的办法,因为要求是必须两个表单?
lzp4881 2008-10-19
  • 打赏
  • 举报
回复
要想取得ZM的值,redio必须跟提交2放在一个表单里。而你现在是用了2个表单,所以提交表单2时无法取得redio的值。
其实你可以这样

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE3 {color: #FF0000}
-->
</style>

<script>
function submit1(){
myForm.action="2.asp?K6=K10";
myForm.submit();
}
function submit2(){
myForm.action="2.asp?K6=K13";
myForm.submit();
}
</script>

</head>

<body>
<form action="" method="post">
<table width="100%" border="1" align="center" cellpadding="2" cellspacing="1">
<tr>
<td align="center" bgcolor="#FFFF00">PCBA</td>
<td align="center" bgcolor="#FFFF00"><span class="STYLE3">PCB</span></td>
<td align="center" bgcolor="#FFFF00"><span class="STYLE3">HIC</span></td>
<td align="center" bgcolor="#FFFF00">单元基板</td>
</tr>
<tr>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V1号'" name="zm" type="radio" value="P1" <%if zm="P1" then%>checked<%end if%> /></td>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V2号'" type="radio" name="zm" value="P2" <%if zm="P2" then%>checked<%end if%> /></td>
<td align="center"><input onclick="window.location.href='rate_zmt.Asp?zm=V3号'" type="radio" name="zm" value="P3" <%if zm="P3" then%>checked<%end if%> /></td>
<td align="center"><input type="radio" onclick="window.location.href='rate_zmt.Asp?zm=V4号'" name="zm" value="P4" <%if zm="P4" then%>checked<%end if%> /></td>
</tr>
<tr>
<td align="center" colspan="4"><input type="button" value="提交" onclick="submit1()" /><input type="button" value="提交2" onclick="submit2()" />
</table>
</form>


<in>
</body>
</html>

这样在2.asp中就可以用
Request("K6")和Request("zm") 分别取得K6和ZM的值了。

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧