按钮元素和Internet Explorer 6.0 [英] Button Element and Internet Explorer 6.0

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

问题描述




我想使用Button元素提交一个如下例子的表格:


< form action =" ; /test.exe" method =" post">

< button id =" ID_BUTTON_OK"名称= QUOT; _WEB_EVENT_HANDLER_" type =" submit"

value =" ID_BUTTON_OK">登录< / button>

< / form>

如果我提交表单后,_WEB_EVENT_HANDLER_获取值Login,

但是如HTML 4.01中所定义,提交的值应该是Button元素中的

值字段(在这种情况下为ID_BUTTON_OK)。

我正在使用最新的Internet Explorer系列6.在Mozilla

浏览器中它完美运行!


Internet Explorer是否完全错误?或者我是这样做错了吗?感谢'求救!

Dominik

HTML 4.01

------------ ---------------------------------------------

17.5 BUTTON元素

<!元素按钮 - -

(%流量;)* - (A |%formctrl; | FORM | FIELDSET)

- 按钮 - >

<!ATTLIST按钮

%attrs; - %coreattrs,%i18n,%事件

-

名称CDATA #IMPLIED

值CDATA #IMPLIED - 发送到服务器时

提交 -

类型(按钮|提交|重置)提交 - 用作表单按钮

-

禁用(禁用)#IMPLIED - 在此上下文中不可用

-

tabindex NUMBER #IMPLIED - 在Tabbing顺序中的位置 -

accesskey%字符; #IMPLIED - 辅助功能关键字符

-

onfocus%Script; #IMPLIED - 元素得到了关注 -

onblur%Script; #IMPLIED - 元素失去了焦点

-



----------- ----------------------------------------------

解决方案

Dom写道:

我想使用Button元素提交表格


您可能需要考虑< input type =" submit">相反。

http:// www.htmlhelp.com/reference/ht...ms/button.html

< form action =" /test.exe" method =" post">
< button id =" ID_BUTTON_OK" name =" _WEB_EVENT_HANDLER_"
type =" submit" value =" ID_BUTTON_OK">登录< / button>
< / form>

如果我提交表单,_WEB_EVENT_HANDLER_获取值登录




url?


-

Brian(删除.invalid给我发电子邮件)
http://www.tsmchughs.com/


2004年8月3日07:24:34 -0700, dh***@gmx.de (Dom )写道:



我想使用Button元素提交一个像这个例子的表格:

< form action =" /test.exe" method =" post">
< button id =" ID_BUTTON_OK"名称= QUOT; _WEB_EVENT_HANDLER_" type =" submit"
value =" ID_BUTTON_OK">登录< / button>
< / form>

如果我提交表单,_WEB_EVENT_HANDLER_获取值登录,
但是如HTML 4.01中所定义,提交的值应该是按钮元素中的
值字段(在这种情况下为ID_BUTTON_OK)。
我'使用最新的Internet Explorer系列6.在Mozilla
浏览器中,它运行得非常好!

Internet Explorer是否完全错误?或者我这样做错了吗?感谢'求助!




我记得,是的...... Internet Explorer错了。你可以做的事情不是很多。 (我假设他们有点过分重用

代码来自< input type =" submit" ...> ;.)


现在,一个解决方法是给每个按钮一个不同的名称,只需要检查是否存在该名称,忽略该值。注意,

但是,许多浏览器不会发送*任何*您的按钮作为

成功控制如果表单是通过点击输入提交的。在一个

文本字段而不是触发按钮,所以你将不得不选择一个

安全默认情况,因为它们根本不会出现。


一切顺利,

-Claire


好的谢谢Claire。但是你认为微软会解决这个问题吗?

我记得,是的...... Internet Explorer弄错了。你可以做很多事情。 (我假设他们有点过分重用
代码来自< input type =" submit" ...> ;.)

目前,解决方法是给每个按钮一个不同的名称,只是检查该名称的存在,忽略该值。注意,但是,如果表单是通过点击输入提交的,那么很多浏览器都不会发送*任何*您的按钮作为成功的控件。在
文本字段而不是触发按钮,所以你必须选择一个
安全的默认情况,当它们根本没有出现时。



Hi,

I wanted to use the Button Element to submit a form like this example:

<form action="/test.exe" method="post">
<button id="ID_BUTTON_OK" name="_WEB_EVENT_HANDLER_" type="submit"
value="ID_BUTTON_OK">Login</button>
</form>
If I submit the form, the _WEB_EVENT_HANDLER_ gets the value "Login",
but as defined in HTML 4.01 the value which is submitted should be the
value field in the Button Element ("ID_BUTTON_OK" in this case).
I''m using the newest Internet Explorer Series 6. At the Mozilla
Browser it works perfectly!

Is the Internet Explorer doing this thing totally wrong??? Or am I
doing this thing wrong? Thank''s for help!

Dominik
HTML 4.01
---------------------------------------------------------
17.5 The BUTTON element
<!ELEMENT BUTTON - -
(%flow;)* -(A|%formctrl;|FORM|FIELDSET)
-- push button -->
<!ATTLIST BUTTON
%attrs; -- %coreattrs, %i18n, %events
--
name CDATA #IMPLIED
value CDATA #IMPLIED -- sent to server when
submitted --
type (button|submit|reset) submit -- for use as form button
--
disabled (disabled) #IMPLIED -- unavailable in this context
--
tabindex NUMBER #IMPLIED -- position in tabbing order --
accesskey %Character; #IMPLIED -- accessibility key character
--
onfocus %Script; #IMPLIED -- the element got the focus --
onblur %Script; #IMPLIED -- the element lost the focus
--


---------------------------------------------------------

解决方案

Dom wrote:

I wanted to use the Button Element to submit a form
You might want to consider <input type="submit"> instead.

http://www.htmlhelp.com/reference/ht...ms/button.html
<form action="/test.exe" method="post">
<button id="ID_BUTTON_OK" name="_WEB_EVENT_HANDLER_"
type="submit" value="ID_BUTTON_OK">Login</button>
</form>

If I submit the form, the _WEB_EVENT_HANDLER_ gets the value "Login"



url?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/


On 3 Aug 2004 07:24:34 -0700, dh***@gmx.de (Dom) wrote:

Hi,

I wanted to use the Button Element to submit a form like this example:

<form action="/test.exe" method="post">
<button id="ID_BUTTON_OK" name="_WEB_EVENT_HANDLER_" type="submit"
value="ID_BUTTON_OK">Login</button>
</form>
If I submit the form, the _WEB_EVENT_HANDLER_ gets the value "Login",
but as defined in HTML 4.01 the value which is submitted should be the
value field in the Button Element ("ID_BUTTON_OK" in this case).
I''m using the newest Internet Explorer Series 6. At the Mozilla
Browser it works perfectly!

Is the Internet Explorer doing this thing totally wrong??? Or am I
doing this thing wrong? Thank''s for help!



As I recall, yes... Internet Explorer gets this wrong. There''s not
much you can do about it. (I assume they went a bit too far reusing
code from <input type="submit" ...>.)

For now, a workaround is to give each button a different name and just
check for the presence of that name, disregarding the value. Note,
though, that many browsers won''t send *any* of your buttons as
successful controls if the form is submitted by "hitting enter" in a
text field rather than triggering the button, so you''ll have to pick a
safe default case for when none of them appear at all.

All the best,
-Claire


Ok thank you Claire. But do you think Microsoft will fix it?

As I recall, yes... Internet Explorer gets this wrong. There''s not
much you can do about it. (I assume they went a bit too far reusing
code from <input type="submit" ...>.)

For now, a workaround is to give each button a different name and just
check for the presence of that name, disregarding the value. Note,
though, that many browsers won''t send *any* of your buttons as
successful controls if the form is submitted by "hitting enter" in a
text field rather than triggering the button, so you''ll have to pick a
safe default case for when none of them appear at all.



这篇关于按钮元素和Internet Explorer 6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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