电台提交按钮问题 [英] Radio Submit Button Problem

查看:83
本文介绍了电台提交按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。我希望那里的人比我更精通JavaScript而不是

我可以帮助我解决以下恼人的问题。这是

问题。


我的表格有以下布局:


A栏B栏C栏

数据4单选按钮更多数据

.... ......

.... ....


表单上有一个提交按钮,可以指向给定的CGI脚本。

表单中还有提交按钮作为onClick事件。收音机

按钮,指向不同的CGI脚本。问题是我需要知道哪个特定的单选按钮触发了onClick

事件,因为当我收到表单数据时,我只想处理

触发事件的数据行。由于脚本现在是
,我只是从表单中收到所有内容,而不知道要实际处理的是哪个
行。我想到的一件事就是

用onClick事件调用一个函数来接收给定的行

id(1到最多279),以及使用document.write为该id创建一个

隐藏值。我不知道这是否可行,

虽然。这个想法我在正确的轨道上吗?这是可行的吗?或者我想考虑尝试不同的方法吗?


谢谢!!!

Hi. I hope someone out there who is more versed with JavaScript than
I can help me with the following annoying problem. Here''s the
problem.

I have a form with the following layout:

Column A Column B Column C
data 4 radio buttons more data
.... ... ...
.... ... ...

The form does have a submit button that leads to a given CGI script.
The form also has submit buttons as onClick events inside of the radio
buttons, that point to a different CGI script. The problem is that I
need to know which particular radio button triggered the onClick
event, because when I receive the form data, I only want to process
the row of data for which an event was triggered. As the script is
now, I just receive everything from the form, without knowing which
row to actually process. The one thing I thought about trying was to
call a function with the onClick event that would receive a given row
id (1 through up to 279), and the use document.write to create a
hidden value for just that id. I don''t know if this is workable,
though. Am I on the right track with this idea? Is this doable, or
should I think about trying a different approach?

Thanks!!!

推荐答案

在文章< b3 ************************* @ posting.google.com> ,
jr*********@yahoo.com (JR)写道:
In article <b3*************************@posting.google.com> ,
jr*********@yahoo.com (JR) wrote:
嗨。我希望那些对JavaScript更精通的人比
我可以帮助我解决以下恼人的问题。这是
问题。

我有一个具有以下布局的表格:

列A列B列C
数据4单选按钮更多数据
...... ......
...... ......

表单确实有一个提交按钮,可以指向给定的CGI脚本。
表单还有提交按钮作为收音机
按钮内的onClick事件,指向不同的CGI脚本。问题是我需要知道哪个特定的单选按钮触发了onClick
事件,因为当我收到表单数据时,我只想处理一个事件的数据行被触发了。由于脚本现在是
,我只是从表单中收到所有内容,而不知道实际处理哪一行。我想尝试的一件事是用一个onClick事件来调用一个函数,该事件将接收一个给定的行
id(1到最多279),并使用document.write创建一个
谢谢!!!
Hi. I hope someone out there who is more versed with JavaScript than
I can help me with the following annoying problem. Here''s the
problem.

I have a form with the following layout:

Column A Column B Column C
data 4 radio buttons more data
... ... ...
... ... ...

The form does have a submit button that leads to a given CGI script.
The form also has submit buttons as onClick events inside of the radio
buttons, that point to a different CGI script. The problem is that I
need to know which particular radio button triggered the onClick
event, because when I receive the form data, I only want to process
the row of data for which an event was triggered. As the script is
now, I just receive everything from the form, without knowing which
row to actually process. The one thing I thought about trying was to
call a function with the onClick event that would receive a given row
id (1 through up to 279), and the use document.write to create a
hidden value for just that id. I don''t know if this is workable,
though. Am I on the right track with this idea? Is this doable, or
should I think about trying a different approach?

Thanks!!!




不要认为你可以在页面渲染后做document.write。


这就是我要做的:


放入隐藏的输入字段。创建一个函数来处理onClick

事件。将单选按钮的ID传递给该功能。函数

然后将隐藏字段的值设置为id是什么。


有意义吗?



Don''t think you can do document.write after the page has rendered.

Here''s what I''d do:

Put in a hidden input field. Create a function to handle the onClick
event. Pass the id of the radio button to the function. The function
then sets the value of the hidden field to whatever the id is.

Make sense?

感谢您的回复。我会试试这个想法。这听起来像是一个可行的解决方案。如果确实有效,我会将代码发布到我的下一个

回复 - 其他人可能会遇到同样的问题。


再次感谢。

***通过开发人员指南发送 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!
Thanks for the reply. I''ll give this idea a try. It sounds like a
workable solution. If it does work, I''ll post the code in my next
reply-someone else out there may have the same problem.

Thanks again.
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


jr ********* @ yahoo.com (JR)在留言新闻中写道:< b3 *** **********************@posting.google.c om> ...
jr*********@yahoo.com (JR) wrote in message news:<b3*************************@posting.google.c om>...
嗨。我希望那些对JavaScript更精通的人比
我可以帮助我解决以下恼人的问题。这是
问题。

我有一个具有以下布局的表格:

列A列B列C
数据4单选按钮更多数据
...... ......
...... ......

表单确实有一个提交按钮,可以指向给定的CGI脚本。
表单还有提交按钮作为收音机
按钮内的onClick事件,指向不同的CGI脚本。问题是我需要知道哪个特定的单选按钮触发了onClick
事件,因为当我收到表单数据时,我只想处理一个事件的数据行被触发了。由于脚本现在是
,我只是从表单中收到所有内容,而不知道实际处理哪一行。我想尝试的一件事是用一个onClick事件来调用一个函数,该事件将接收一个给定的行
id(1到最多279),并使用document.write创建一个
谢谢!!!
Hi. I hope someone out there who is more versed with JavaScript than
I can help me with the following annoying problem. Here''s the
problem.

I have a form with the following layout:

Column A Column B Column C
data 4 radio buttons more data
... ... ...
... ... ...

The form does have a submit button that leads to a given CGI script.
The form also has submit buttons as onClick events inside of the radio
buttons, that point to a different CGI script. The problem is that I
need to know which particular radio button triggered the onClick
event, because when I receive the form data, I only want to process
the row of data for which an event was triggered. As the script is
now, I just receive everything from the form, without knowing which
row to actually process. The one thing I thought about trying was to
call a function with the onClick event that would receive a given row
id (1 through up to 279), and the use document.write to create a
hidden value for just that id. I don''t know if this is workable,
though. Am I on the right track with this idea? Is this doable, or
should I think about trying a different approach?

Thanks!!!




从我看到的,唯一的方法是有一个循环,并检查每个

单选按钮的已检查和属性。如果你给单选按钮

同名,它们会形成一个数组,所以你可以使用for循环。



From what I see, the only way is to have a loop, and check each
radio button for the "checked" property. If you give the radio buttons
the same name, they form an array, so you can use a for-loop.


这篇关于电台提交按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆