[thelist] input type focus with javascript

Michael Robertson mike at mikeemedia.com
Tue Nov 26 15:20:01 CST 2002


good call -- thank you


----- Original Message -----
From: "Rob Whitener" <rwhitener at DesignOptions.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, November 26, 2002 3:19 PM
Subject: RE: [thelist] input type focus with javascript


> function setFocus(){
>  for(var i=0;i< document.forms[0].elements.length;i++){
>   if(document.forms[0].elements.type != 'hidden'){
>    document.forms[0].elements.focus();
>    break;
>   }
>  }
> }
>
>
> Try giving the form a name and use each elements name to access them like
> this:
>
> document.formname.elementname.type != 'hidden';
>
> or, if you don't want to use the element name, you will need to access
each
> element by index:
>
> document.formname.elements[i].type != 'hidden';
>
> I think that when you call just elements you are really getting a pointer
to
> all elements within that form, so you aren't really looking at individual
> elements making the statement 'document.forms[0].elements.type'
meaningless.
> -----Original Message-----
> From: Michael Robertson [mailto:mike at mikeemedia.com]
> Sent: Tuesday, November 26, 2002 3:08 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] input type focus with javascript
>
>
> trying to write a function that will set focus to first form element that
is
> not a hidden input. This is not working but also not producing an error.
any
> suggestion?
>
> function setFocus(){
>  for(var i=0;i< document.forms[0].elements.length;i++){
>   if(document.forms[0].elements.type != 'hidden'){
>    document.forms[0].elements.focus();
>    break;
>   }
>  }
> }
>
>
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
>





More information about the thelist mailing list