帮助onclick提交 [英] help with onclick submit
问题描述
在一个未命名的表单中,未命名,因为它只提交一个电子邮件地址,我是
试图让提交按钮清除电子邮件。
文本框中的文本值。
在提交按钮上,我有以下内容:
onClick =" ;若(this.form [ '' 电子邮件 '']值== '' 电子邮件'。)this.form [ '' 电子邮件 '']值= '' '' "。<无线电通信/>
但它似乎不起作用。有什么想法或建议吗?
提前致谢!
John写道:在未命名的表单中,未命名,因为它只提交了一个电子邮件地址,我试图让提交按钮清除电子邮件。
文本框中的文本值。
在提交按钮上,我有以下内容:
onClick =" if(this.form [''e-mail ''] .value ==''电子邮件'')this.form [''电子邮件'']。value =''''"
但它似乎没有工作。有任何想法或建议吗?
提前致谢!
您正在错误地访问表单元素。请尝试以下
:
this.form.elements [''电子邮件'']。值
" web.dev" <我们******** @ gmail.com>在消息中写道
news:11 ********************** @ g47g2000cwa.googlegr oups.com ...
您正在错误地访问表单元素。请尝试以下
:
this.form.elements [''e-mail'']。value
谢谢但它似乎不起作用。
这在这里有效:
< input type =" text"名称= QUOT;电子邮件" value =" e-mail"
onClick =" if(this.value ==''e-mail'')this.value =''''">
然后就在下面,根据你的
建议我有我的提交按钮的行:
< input type = [提交" value =" Go!"
onClick =" if(this.form.elements [''e-mail'']。value ==''e-mail'')this。 form.elements [''e-mail'']。value =''''">
不幸的是它不起作用。
>
还有其他想法吗?
谢谢!
John写道:< blockquote class =post_quotes>" web.dev" <我们******** @ gmail.com>在消息中写道
新闻:11 ********************** @ g47g2000cwa.googlegr oups.com ...
您正在错误地访问表单元素。请尝试以下
:
this.form.elements [''e-mail'']。value
谢谢,但它没有似乎有效。
这在这里有效:
< input type =" text"名称= QUOT;电子邮件" value =" e-mail"
onClick =" if(this.value ==''e-mail'')this.value =''''">
>然后在我的
建议下,我有提交按钮的行:
< input type =" submit" value =" Go!"
onClick =" if(this.form.elements [''e-mail'']。value ==''e-mail'')this.form.elements [ ''电子邮件'']。值='''''">
不幸的是它没有用。
还有其他想法吗?>
谢谢!
很抱歉这个混乱,当你第一次发布时我曾想过你的输入元素的名字是
"电子邮件" ;.这次尝试使用相同的解决方案
用''email''替换''e-mail'':
this.form.elements [''email ''] .value
In an unnamed form, unnamed because it only submits an email address, I''m
trying to have the submit button clear the "e-mail" text value in the
textbox.
On the submit button I have the following:
onClick="if(this.form[''e-mail''].value==''e-mail'')this.form[''e-mail''].value=''''"
But it does not seem to work. Any ideas or suggestions?
Thanks in advance!
John wrote:In an unnamed form, unnamed because it only submits an email address, I''m
trying to have the submit button clear the "e-mail" text value in the
textbox.
On the submit button I have the following:
onClick="if(this.form[''e-mail''].value==''e-mail'')this.form[''e-mail''].value=''''"
But it does not seem to work. Any ideas or suggestions?
Thanks in advance!
You are accessing the form elements incorrectly. Try the following
instead:
this.form.elements[''e-mail''].value
"web.dev" <we********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
You are accessing the form elements incorrectly. Try the following
instead:
this.form.elements[''e-mail''].value
Thanks but it does not seem to work.
This here works:
<input type="text" name="email" value="e-mail"
onClick="if(this.value==''e-mail'')this.value=''''">
Then right below I have the line for my submit button as per your
suggestion:
<input type="submit" value="Go!"
onClick="if(this.form.elements[''e-mail''].value==''e-mail'')this.form.elements[''e-mail''].value=''''">
Unfortunately it''s not working.
Any other ideas?
Thanks!
John wrote:"web.dev" <we********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
You are accessing the form elements incorrectly. Try the following
instead:
this.form.elements[''e-mail''].value
Thanks but it does not seem to work.
This here works:
<input type="text" name="email" value="e-mail"
onClick="if(this.value==''e-mail'')this.value=''''">
Then right below I have the line for my submit button as per your
suggestion:
<input type="submit" value="Go!"
onClick="if(this.form.elements[''e-mail''].value==''e-mail'')this.form.elements[''e-mail''].value=''''">
Unfortunately it''s not working.
Any other ideas?
Thanks!
Sorry for the confusion, when you first posted I had thought the name
of your input element was "e-mail". Try the same solution this time
replacing ''e-mail'' with ''email'':
this.form.elements[''email''].value
这篇关于帮助onclick提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!