Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Passing focus back to a textarea


Message #1 by "Chris Cote" <cotec@s...> on Thu, 4 Apr 2002 16:34:41
> Thank you Phil. I didn't realize focus needed parentheses.  Now the 
q> uestion I have is how do I have the cursor go directly to the end of 
the 
t> ext that's in the textarea?

> Chris

Hi Chris

Try the following substitute yourformame for the name of your form.
you can loose the tbText.focus() and enter the following in you function:-

field = document.yourformname.tbText;

if (field.createTextRange()) {
f = field.createTextRange();
f.moveStart('character', field.value.length);
f.collapse();
f.select();

}

phil

  Return to Index