Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Set Focus


Message #1 by hkrupp@b... on Wed, 23 Oct 2002 00:57:47
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.

  Return to Index