Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: SV: Set Focus


Message #1 by "Robert Nyman" <robert.nyman@c...> on Wed, 23 Oct 2002 09:30:51 +0200
I take for granted that this: 'The function is being called 'onchange' '
means that it is being called on
the onChange event (not that the function is named onchange, which would
be a very bad idea)...

The code for setting focus seems fine, so try using the onBlur event
instead.

In what order is the code, the alert first and then setting the focus?
Whichever way it is, try switching it around and see what happens.


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: hkrupp@b... [mailto:hkrupp@b...]
Skickat: den 23 oktober 2002 00:58
Till: JavaScript HowTo
=C4mne: [javascript_howto] Set Focus


I have a function that validates some numbers on a form.  The function
is
being called 'onchange' after you have tabbed or clicked out of the box.

If the numbers are wrong, I want to set the focus back to the input box
we
came from. 
Here is the piece of code I am using.
  document.all(sRow).focus();
  alert("You have gone over your appropriation.  Please correct it.");
It pops the message just fine, but does not set the focus back to the
box.  It stays on the box we tabbed to.  I can set the focus in other
situations just fine, it is just this onchange event that is causing a
problem.

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20


  Return to Index