关于< select>的更改事件在Firefox中使用光标键时不会触发 [英] On change event of <select> in Firefox doesn't fire when using cursor keys

查看:86
本文介绍了关于< select>的更改事件在Firefox中使用光标键时不会触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个< select>我已经设置了一个onchange事件,当我在列表中上下使用光标时,在IE中触发了
,但如果我使用

光标在Firefox中上下这个事件似乎没有开始,直到

我已经离开了这个领域....如果我使用鼠标一切都很好,只有在使用时才会使用

光标键不会触发FF中的onchange事件。

感谢您提前提供任何帮助。

Michael

解决方案

xx ******** @ supergambler。 com 写道:

我有一个< select>当我在列表中上下使用光标时,我已经设置了一个在IE中激活的onchange事件,但是如果我在Firefox中上下使用光标,那么事件不会似乎要开火直到
我已经离开了这个领域....如果我使用鼠标一切都很好,只有当使用
光标键时才会触发FF中的onchange事件。




你称之为游标是什么? (它们是列表滚动条中的箭头吗?)


在我的Mac上,箭头键和/或键盘向下:

- IE滚动窗口

- FF做你说你的IE做的

-

Stephane Moriaux et son [moins] vieux Mac


xx********@supergambler.com 写道:< blockquote class =post_quotes>我有一个< select>当我在列表中上下使用光标时,我已经设置了一个在IE中激活的onchange事件,但是如果我在Firefox中上下使用光标,那么事件不会似乎要开火直到
我已经离开了这个领域....如果我使用鼠标一切都很好,只有当使用
光标键时才会触发FF中的onchange事件。




我想您未提出的问题是如何获得一致的行为? -

答案是不要使用select来触发onchange事件(这可能不是你想要听到的
)。


W3C规范说,当控件失去焦点时,onchange应该触发

(如果值已经改变)。 IE不会等待,只要选择了选项,它就会激活

。如果您使用键盘,Firefox会等待,但是如果您使用鼠标则不会等待



各种浏览器和规范之间还存在其他不一致之处,

遗憾的是结果有点混乱。


如果你解释一下你想要做什么其他一些解决方案可以是

建议。


-

Rob


RobG写道:

如果您使用键盘,Firefox会等待,但如果使用鼠标则不会。


完全没有:
我的Mac上的
我的FF(doctype transitional 4.0)

它会在每次更改时触发(按键盘的箭头键或点击)

(通过升降机或鼠标滚动列表 - >没有变化或火灾)

各种浏览器之间存在其他不一致之处规格,不幸的是结果有点乱。




不幸(汤希尔)

-

Stephane Moriaux et son [moins] vieux Mac


I have a <select> object that i''ve set up an onchange event that fires
in IE fine when I use the cursor up and down in the list, but If I use
the cursor up and down in Firefox the event doesn''t seem to fire until
I''ve left the field....If i use the mouse all is fine, only when using
the cursor keys does it not fire the onchange event in FF.
Thanks for any help in advance.
Michael

解决方案

xx********@supergambler.com wrote:

I have a <select> object that i''ve set up an onchange event that fires
in IE fine when I use the cursor up and down in the list, but If I use
the cursor up and down in Firefox the event doesn''t seem to fire until
I''ve left the field....If i use the mouse all is fine, only when using
the cursor keys does it not fire the onchange event in FF.



What do you call cursors ? (are they arrows in scrollbar of list ?)

on my Mac, with arrow keys up and/or down of keyboard :
- IE scrolls window
- FF does what you say your IE does
--
Stephane Moriaux et son [moins] vieux Mac


xx********@supergambler.com wrote:

I have a <select> object that i''ve set up an onchange event that fires
in IE fine when I use the cursor up and down in the list, but If I use
the cursor up and down in Firefox the event doesn''t seem to fire until
I''ve left the field....If i use the mouse all is fine, only when using
the cursor keys does it not fire the onchange event in FF.



I guess your unasked question is "How do I get consistent behaviour" -
the answer is to not use a select to fire onchange events (which is
probably not what you want to hear).

The W3C spec says that onchange should fire when the control loses focus
(provided the value has changed). IE doesn''t wait, it fires as soon as
the option is selected. Firefox does wait if you use the keyboard, but
not if you use the mouse.

There are other inconsistencies between various browsers and the spec,
unfortunately the result is a bit of a mess.

If you explain what you are trying to do some other solution can be
proposed.

--
Rob


RobG wrote:

Firefox does wait if you use the keyboard, but
not if you use the mouse.
Not at all :
on my Mac with my FF (doctype transitional 4.0)
it fires on each change (by keyboard''s arrow key or by click)
(scrolling list by lift or mouse well -> no change or fire)
There are other inconsistencies between various browsers and the spec,
unfortunately the result is a bit of a mess.



unfortunatly (soupir)
--
Stephane Moriaux et son [moins] vieux Mac


这篇关于关于&lt; select&gt;的更改事件在Firefox中使用光标键时不会触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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