Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: Re: Passing focus back to a textarea


Message #1 by pabiboy@y... on Fri, 4 Oct 2002 17:39:15
Hi Phil.  This idea works great!  However, is it possible to further 
narrow the placement of the focus?

I have a script that inserts html format tags into a textarea, and I want 
the focus to end up between the tags. Any idea how this could be done?

Thanks!!

Steve Johnson

> Try the following substitute yourformame for the name of your form.
y> ou 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