开发者

IE7+ does not execute events if control does not lose focus

开发者 https://www.devze.com 2022-12-15 18:21 出处:网络
I have a input control (a Text Box) which has some javascript events associated with it (change, keypress, select, click). The first time my page is executed, I type some value in this input control a

I have a input control (a Text Box) which has some javascript events associated with it (change, keypress, select, click). The first time my page is executed, I type some value in this input control and then click on my button. This button executes some ajax code, send some info to a application server and it is OK. Also, the Text Box related events are executed properly (these events runs some code that checks which controls have its values changed, so these changes can be sent to the server).

The 2nd time I type some value in this input control, the associ开发者_运维问答ated events are not executed properly, except if I first click outside the control and click inside the control again, so I can type some value and then then associated TextBox events are executed.

It only happens on IE7+, works fine on other browsers, like FF, Safari, Opera and Chrome. It seems that IE does not change the focus from the TextBox when I press my button and for some unknown reason, IE "forgets" about those events.

Just to clarify, my page consists of some HTML/JavaScript/AJAX code that communicates with a Application Server written in Delphi.

Please let me know if I was not clear enought and thanks for your time.

-- Jackson Gomes


I added a function that set the focus on the next element of the form in the onBlur event of my input element as a hack to my problem and it solves it (IE seems to re-recoginize the events if the focus moves to another control).

Now if I explicity set the focus on the input element again (even with the function call I described above), the problem appears.

I really do not understand why it happens and if it is a IE7+ bug or not.

The hack works, but if I want the focus on the input element, it does not.

:-(

-- Jackson Gomes


How about moving the focus and then moving it back? Kinda like a blink...

0

精彩评论

暂无评论...
验证码 换一张
取 消