Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Textbox colour change


Message #1 by darrenpgraham@h... on Wed, 26 Feb 2003 18:05:41
Hmmm, I don't really agree. Apparently the putFocus function can be used to 
set the focus on any element on any form in your page. Just pass it a form 
index and a control index, and voila, instant focus.

For example:

     putFocus(3, 2);

will set the focus on the 3rd control of the fourth form in the entire 
page. Looks useful to me....

Cheers,


Imar



>What's the putFocus() function for? If there's more than more form in the 
>page, why not just use onfocus="document.forms[0].elements[0].focus();"
>? Otherwise this is a useless function.
>
>  function putFocus(formInst, elementInst) {
>>   if (document.forms.length > 0) {
>>    document.forms[formInst].elements[elementInst].focus();
>>   }
>>  }



  Return to Index