经典的 asp 单选按钮组获取值

发布于 2024-09-12 17:12:39 字数 74 浏览 1 评论 0原文

有没有办法在表单帖子上迭代单选组以对每个单选按钮组执行某些操作?我有不同数量的单选按钮集,需要在回发时获取每个单选按钮集的值和 id。

Is there a way to iterate radio groups on a form post to do something with each radio button group? I have a varying number of radio button sets and need to get values and id's out of each of them on a postback.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雄赳赳气昂昂 2024-09-19 17:12:39

我不确定这就是您正在寻找的东西,但它可能会为您指明正确的方向。如果您为单选按钮的所有名称添加前缀“rb”(或您选择的其他前缀),则以下内容应该允许您访问帖子上的每个单选按钮:

for x = 1 to Request.Form.count() 
    if(Left(Request.Form.key(x),2) = "rb") then
        Response.Write(Request.Form.key(x) & " = " & Request.Form.item(x) & "<br/>") 
    end if
next 

I'm not sure this is what you're looking for, but it might point you in the right direction. If you prefix all names of your radio buttons with "rb" (or some other prefix of your choosing), then the following should give you access to each radio button on a post:

for x = 1 to Request.Form.count() 
    if(Left(Request.Form.key(x),2) = "rb") then
        Response.Write(Request.Form.key(x) & " = " & Request.Form.item(x) & "<br/>") 
    end if
next 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文