取得动态文本框的值!

steamlin 2010-07-29 10:24:54
<form id="form1" name="form1" method="post" action="11-1.asp?">
<input name="num_1" type="text" id="num_1" />
<input name="id" type="checkbox" id="id" value="1" />
<br />
<br />
<input name="num_2" type="text" id="num_2" />
<input name="id" type="checkbox" id="id" value="2" />
<br />
<br />
<input name="num_3" type="text" id="num_3" />
<input name="id" type="checkbox" id="id" value="3" />
<br />
<br />
<input name="num_4" type="text" id="num_4" />
<input type="checkbox" name="checkbox4" value="4" />
<br />
<br />
<input name="num_5" type="text" id="num_5" />
<input name="id" type="checkbox" id="id" value="5" />
<br />
<br />
<br />
<input type="submit" name="Submit" value="提交" />
</form>

<%
if request("Submit")<>"" then
pid=request("id")
pida=split(pid,",")
pnum=""
for i=0 to ubound(pida)
pnum=pnum&request("Num_"&pida(i))&","
response.Write("Num_"&pida(i)&"")
response.Write("<BR>")
response.Write(request.Form("Num_"&pida(i)&""))
response.Write("<BR>")
Next
response.End()
end if
%>
当选中那右侧的复选框。就取得左侧文本框的值。
但奇怪的是,这个,当你选中两个或以上的复选框里,所取得的值,怎么都是只能取得第一个选中复选框的值。

这个是页面。http://www.shell168.com/11-1.asp

最终要实现的是。选中右侧复选框。而取得左侧对应的文本所输入的值!!!
...全文
70 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
steamlin 2010-07-29
  • 打赏
  • 举报
回复
我晕。。。原来是没去两边空格。。。!
记得以前都用过这个法子。。。!
谢楼上的!
Dogfish 2010-07-29
  • 打赏
  • 举报
回复
if request("Submit")<>"" then
pid=request("id")
pida=split(pid,",")
pnum=""
for i=0 to ubound(pida)
l_id = trim(pida(i))
pnum=pnum&request("Num_" & l_id)
response.Write("Num_" & l_id)
response.Write("<BR>")
response.Write(request.Form("Num_" & l_id))
response.Write("<BR>")
Next
response.End()
end if
steamlin 2010-07-29
  • 打赏
  • 举报
回复
checkbox的值。是能用同一个ID取得。
但是我还要取得左侧对应文本的框。这个文本框,的名字跟ID都是不相同的。
zengbingling 2010-07-29
  • 打赏
  • 举报
回复
checkbox都用了同一个id

28,391

社区成员

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

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