General discussion

Locked

Error in Java Script.SetFocus in IE5?

By agworld ·
1.In my code, a text field with size=3, max size=3, after each letter typed I run a java script to check the lenght of the field. If lenght ==2 (i.e. 3 letters entered), then Set Focus to next field.

2. The above logic worked fine in IE4, and also in Netscape 4.
3. But in IE5, when the 3rd letter is entered, control goes to next field WITHOUT setting the last letter entered. So atmost 2 leters may be entered.
4. Is there any patch available to rectify this? Any work around?

We have used above logic for each field entry in the entire application. The solution thus has to be a highly optimised in terms of effort.
**Our users use both IE4 and IE5 at present.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Error in Java Script.SetFocus in IE5?

by Peter Ritchie In reply to Error in Java Script.SetF ...

Without seeing the code there's not much we can help you with.

Which event are you using? are you returning false false from that event code?

Collapse -

Error in Java Script.SetFocus in IE5?

by agworld In reply to Error in Java Script.SetF ...

The question was auto-closed by TechRepublic

Collapse -

Error in Java Script.SetFocus in IE5?

by OddballSixActual In reply to Error in Java Script.SetF ...

The only answer i can offer you is the one that most developers seem to dread. Write the code so that in the HTML it refers to your function.

On the function, detect if the browser is IE4 or IE5 using the application related attributes in javascript. If it is IE4, use your current code implementation. If it is IE5, then add one to the length that will refocus and continue.

This way, IE 4 will function as it does now. But then IE 5 will look and on length=2 it will not refocus (thus allowing you to enter the third char) but on length=3 it will not allow you to enter any more charachters but will refocus for you. That way you do not exceed the 3 charachters you are looking for and your code will work in both browsers.

Collapse -

Error in Java Script.SetFocus in IE5?

by agworld In reply to Error in Java Script.SetF ...

The question was auto-closed by TechRepublic

Collapse -

Error in Java Script.SetFocus in IE5?

by agworld In reply to Error in Java Script.SetF ...

This question was auto closed due to inactivity

Back to Windows Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums