Just for the record, here's where you're coming from:

JavaScript onFocus and/or document.formname.boxname.focus() don't work the same in Netscape 3 and NS 4.

What works in one will send the other into an endless loop, and visa versa.

Don't even bother with IE 3--it has no idea what to do with this code.

Suppose you're asking your user to enter data into a couple text boxes, then when the user clicks in a third box, you want JavaScript to subtract these two numbers, and put the answer in the third box. It would be a good idea to check first to see if these really are numbers, and if not, bring up an Alert Window then focus on the problem text box.
When you click on the first box in this form, it will change the status line, change the background color, then pass the focus to the next box. On focus, each box will do that, until it ends up at the last box. Clicking on the first box should re-start the sequence.



Netscape 3 will only execute the commands for a particular box and will not pass the focus on to the next box (or if it does, the onFocus command is not executed).
The first box here brings up a message in an Alert Window, then passes the focus on. Subsequent boxes are set up as in the first form, but don't change the status. Clicking on the first box should re-start the sequence.



Netscape 3 will only go as far as bringing up the Alert Window. After that, nothing on the page will work right (even as it had in NS3 before that).
In this demo, if the focus is not switched to the second box before bringing up the Alert, NS 4 gets into an endless loop. If you want to see, switch the input box for the one that's commented out. Unfortunately, the combination of the onFocus, the change focus code, and bringing up the Alert will totally confuse NS3.

Here's the only work-around I've been able to dream up--this should work in both 3 and 4. This actually half-way works in IE (it will bring up the Alert, but won't change the text in the second box, as requested)--as long as you don't reduce IE to an icon on the task bar (in which case IE merrily brings up a loop of Alerts and won't maximize).


carterjs@uc.edu

Copyright © 1998 by J. Stein Carter. All rights reserved.