This has me stumped, too, but I'd like to find a solution. I'm sure I'll
run into this eventually. I'm surprised I haven't already!
A few more bits of information, in case they help at all:
1) In Netscape 7.1, I can SEE the cursor jump to the proper field, but it's
put back into the "incorrect" field immediately. This happens when I use
the [Tab] key to move out of the field.
2) Similarly, if I change the field and move the focus away by clicking on
another field, the same thing happens.
3) When I use the [Enter] key to move out of the field, the script works
properly. This is probably of limited practical help, but I found it
interesting.
4) When I attach the script to the onKeyUp event instead of the onChange
event, it works just fine... but probably not in a way that is useful to
you.
5) When I add two more fields to the form, add the event to the onChange of
fieldThree, and I change fieldThree and hit [Tab], the cursor goes to
fieldFour, not fieldTwo. In both the original case and this one, the cursor
is being "forced" to go whereever it would normally go after hitting the
[Tab] key or clicking with the mouse, as if the JavaScript were not even
there.
Perhaps this is some sort of security concern built into the browser? To
keep inattentive users from being tricked into typing into hidden fields, or
some such? That's a wild guess, of course. It definitely seems to me as if
the browser is trying to keep the script from overriding the behavior of the
[Tab] key and the mouse.
Sorry that's not a solution... please post to the list or email me if you do
find one.
-----------------
L Lockwood
Webmaster, Programmer/Analyst-II
PP-CS Information Systems Group
3-8467
> -----Original Message-----
> From: owner-webnet-list@lists.berkeley.edu
> [mailto:owner-webnet-list@lists.berkeley.edu] On Behalf Of Josh Marcus
> Sent: Monday, September 20, 2004 2:56 PM
> To: webnet-list@berkeley.edu
> Cc: ERNST, MICHAEL P
> Subject: [Webnet] JavaScript problem with Netscape
>
>
> Webnet,
>
> We are trying to use JavaScript to set the focus on a form input
> element. We are finding that the following code does not work in
> Netscape (versions 6.2 and 7.1). The behavior we see in
> Netscape is that
> the user is advanced to the next field regardless of which field we
> specify to receive focus. In the code below, we want the
> cursor to move
> from Field One to Field Three. Instead, the cursor moves to Field Two.
>
> The code works fine in Mozilla Firefox 1.0PR and IE 6.
>
> ________________________
> <script language="javascript">
> function changeFocus() {
> document.formOne.fieldThree.focus();
> }
> </script>
>
> <form name="formOne">
> Field One: <input type="text" name="fieldOne"
> onChange="changeFocus()"> <br>
> Field Two: <input type="text" name="fieldTwo">
> <br>
> Field Three: <input type="text" name="fieldThree">
> </form>
> ________________________
>
> Can anyone identify a problem with this code? Anyone seen this before?
>
> Thanks,
> Josh
> --------------------------------------------------------------
> ---------
> The following was automatically added to this message by the
> list server:
>
> Webnet information is available at
> http://webnet.berkeley.edu. Email sent to this list is
> archived at http://ls.berkeley.edu/mail/webnet/ . This
> archive is open to the general public and browsable by search
> engine spiders, email-address harvesting robots, your bosses, etc.
>
-----------------------------------------------------------------------
The following was automatically added to this message by the list server:
Webnet information is available at http://webnet.berkeley.edu. Email sent to this list is archived at http://ls.berkeley.edu/mail/webnet/ . This archive is open to the general public and browsable by search engine spiders, email-address harvesting robots, your bosses, etc.
Received on Mon Sep 20 16:03:09 2004
This archive was generated by hypermail 2.1.8 : Mon Sep 20 2004 - 16:03:09 PDT