表单提交按钮后,按钮的名称为&QUOT不会提交;提交" [英] Form submit button will not submit when name of button is "submit"

查看:162
本文介绍了表单提交按钮后,按钮的名称为&QUOT不会提交;提交"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法得到一个表单提交时提交按钮的名称属性是precisely提交。

I am having trouble getting a form to submit when the name attribute of the submit button is precisely "submit".

下面是code:

<输入的onclick =checkForm(document.form_29)及和放大器; document.form_29.submit();值=提交名称=提交类型=按钮>

这是我们没有使用的提交标准的输入型注,而是使用了验证脚本(checkForm)后,提交表单按钮,用JavaScript的输入类型已经回到正确的。

Note that we are not using a standard input type of "submit", but rather an input type of "button" with JavaScript being used to submit the form after a validation script (checkForm) has returned true.

奇怪的是,当且仅当name属性为提交这是不行的。问题是大小写敏感的,所以下面(以及任何其他的命名,包括没有名字属性)将工作:

The odd thing is that this will not work if and only if the name attribute is "submit". The problem is case-sensitive, so the following (and any other naming, including no name attribute) will work:

<输入的onclick =checkForm(document.form_29)及和放大器; document.form_29.submit();值=提交名称=提交类型=按钮>

我一直在寻找在一个保留名称的一些提及W3C规范,但我无法找到任何东西。我怀疑我忽视的东西真的很明显这里,所以我希望你们一些在那里能看到的东西我不能。

I have been looking over the W3C specs for some mention of a reserved name, but I could not find anything. I suspect I am overlooking something really obvious here, so I'm hoping some of y'all out there can see something I can't.

感谢您的帮助。

推荐答案

您遇到问题,因为名称提交被重写 form.submit()为该函数引用<形式> ,而不是 form_29.submit 指的是按钮,而不是DOM 提交()功能。

You're having issues because the name being submit is overriding the form.submit() function reference for that <form>, instead form_29.submit refers to that button, rather than the DOM submit() function.

这篇关于表单提交按钮后,按钮的名称为&QUOT不会提交;提交&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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