Javascript onBlur会导致“隐藏”光标在文本字段中 [英] Javascript onBlur results in "hidden" cursor in text field

查看:72
本文介绍了Javascript onBlur会导致“隐藏”光标在文本字段中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我遇到了一个有趣的问题,我想验证它是Internet Explorer 7的一个错误。


我有一个包含javascript onBlur事件的字段。将焦点设置到文本字段时,它会启动自定义事件处理程序以处理该文本字段中的现有值。在onBlur函数完成之后,光标看起来就像它不在那里,几乎就像它没有将焦点设置到你当前所在的文本字段一样。但事实上,如果你使用键盘上的方向箭头,你会看到焦点确实设置在文本框中,光标只是隐藏了!有人遇到过这种情况么?在我排除IE 7中的错误之前,我已经调试了这个问题几天了。


提前谢谢。

Hello,

I''m running into an interesting issue and I wanted to verify it was a bug with Internet Explorer 7.

I have a field that has an javascript onBlur event. When you set focus to the text field, it launches a custom event handler to process the existing value in that text field. Well after the onBlur function has completed, the cursor looks like it''s not there, almost as if it didn''t set focus to the text field you were currently on. But in fact, if you use the directional arrows on your keyboard, you''ll see the focus has indeed been set to the text box, the cursor was just hidden! Has anyone else encountered this? I''ve been debugging this issue for a couple of days now before I rule out it''s a bug in IE 7.

Thanks in advance.

推荐答案


您好,


我遇到了一个有趣的问题,我想验证这是Internet Explorer 7的一个错误。


我有一个包含javascript onBlur事件的字段。将焦点设置到文本字段时,它会启动自定义事件处理程序以处理该文本字段中的现有值。在onBlur函数完成之后,光标看起来就像它不在那里,几乎就像它没有将焦点设置到你当前所在的文本字段一样。但事实上,如果你使用键盘上的方向箭头,你会看到焦点确实设置在文本框中,光标只是隐藏了!有人遇到过这种情况么?在我排除IE 7中的错误之前,我已经调试了这个问题几天了。




提前致谢。
Hello,

I''m running into an interesting issue and I wanted to verify it was a bug with Internet Explorer 7.

I have a field that has an javascript onBlur event. When you set focus to the text field, it launches a custom event handler to process the existing value in that text field. Well after the onBlur function has completed, the cursor looks like it''s not there, almost as if it didn''t set focus to the text field you were currently on. But in fact, if you use the directional arrows on your keyboard, you''ll see the focus has indeed been set to the text box, the cursor was just hidden! Has anyone else encountered this? I''ve been debugging this issue for a couple of days now before I rule out it''s a bug in IE 7.



Thanks in advance.



我已经看过几次这种情况。你确定这只发生在IE中,因为我确定我在Firefox中已经看过这个好吧。

这不是一个大问题吗?

I''ve seen this happen a few times.Are you sure this only happens in IE because I''m sure I''ve seen this in Firefox as well.
It isn''t a big problem is it?


在这个特殊情况下,这是一个大问题。如果用户正在填写具有查找弹出窗口的大型表单,则每次查找窗口关闭时,我都会通过onBlur将焦点设置回到他们所在的最后一个字段。如果光标不可见,则用户不知道它们离开的位置/焦点设置的字段。当它们穿过字段时也会发生这种情况。当它使用onBlur事件到达特定字段时,它不会显示光标。然后我可以选项卡到下一个字段,光标显示正常。非常奇怪。
In this particular case it''s a big deal. If a user is completing a large form that has look-up pop-ups, each time the look-up window closes I''m setting focus back to the last field they were on via an onBlur. If the cursor isn''t visible, the user doesn''t know where they left off/which field the focus is set. This also occurs when they are tabbing through fields. When it gets to particular fields utilizing the onBlur event, it doesn''t show the cursor. I can then tab to the next field and the cursor shows up fine. Very strange.



在这个特殊情况下,这是一个大问题。如果用户正在填写具有查找弹出窗口的大型表单,则每次查找窗口关闭时,我都会通过onBlur将焦点设置回到他们所在的最后一个字段。如果光标不可见,则用户不知道它们离开的位置/焦点设置的字段。当它们穿过字段时也会发生这种情况。当它使用onBlur事件到达特定字段时,它不会显示光标。然后我可以选项卡到下一个字段,光标显示正常。很奇怪。
In this particular case it''s a big deal. If a user is completing a large form that has look-up pop-ups, each time the look-up window closes I''m setting focus back to the last field they were on via an onBlur. If the cursor isn''t visible, the user doesn''t know where they left off/which field the focus is set. This also occurs when they are tabbing through fields. When it gets to particular fields utilizing the onBlur event, it doesn''t show the cursor. I can then tab to the next field and the cursor shows up fine. Very strange.



我认为这是一个大问题。您是否尝试过先将焦点设置为其他组件,然后将其设置为所需的控件。

PS您是否确认此行为仅适用于IE?

I suppose it is a big deal then. Have you tried the old hack of setting the focus to some other component first then setting it to the required control.
P.S Have you confirmed that this behavior is for IE only?

这篇关于Javascript onBlur会导致“隐藏”光标在文本字段中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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