
focus() doesn't seem to work in IE-6
Quote:
> I'm using jscript verification for a table full of text
> boxes. When a user enters an invalid value, s/he gets the
> appropriate alert, but the focus stays where it was when
> the user moved off of it. I'm passing the text box element
> to the verification routine, and all the attributes
> like .name, .value, etc. work just fine. .focus() alone
> fails.
> Is this a problem with IE? Has anyone else had it? Is
> there a fix or a workaround (I can't find one), and how do
> I get MS involved in this if there isn't?
> Thanks for your help!
Without seeing all the code, I would guess you are calling the validation
function on with the "onchange" event handler and you are losing focus by
hitting the TAB key?
If so, what is happening is that the onchange event is being called before
the field loses focus (i.e., before the onblur event), your code runs, sets
the focus back to the field and exits, then IE finishes the job off by
moving focus from the field to the next item in the tab order.