Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set focus on a checkbox

Status
Not open for further replies.

mtawk

Programmer
Nov 6, 2001
26
IQ
Hello,
Is there a way to setfocus on a checkbox?
i tried select() and focus(), they work on <INPUT TYPE=&quot;TEXT&quot;> but not on <INPUT TYPE=&quot;CHECKBOX&quot;>.

thanks in advance for any help
 
I'm not sure why those don't work;
Code:
select()
is a method of check boxes and radio buttons, and
Code:
focus()
is a core method and so should work on all elements.

Just in case: According to Inside JavaScript by Steven Holzner,
Code:
select()
does not exist in Netscape at all. I currently only develop for IE, because it's the only browser my clients use, so it's not an issue for me.

The only thing I can suggest is to check your syntax and check for typos. Those two things cause 99% of my script errors.

Control syntax:
Code:
document.formname.controlname.select()
where
Code:
formname
and
Code:
controlname
are the names of your form and control, respectively.

Apologies if you already know this, but like I said above, it's the basics that get me all the time; when processes become automatic, you don't check them as closely as you would otherwise.

Hope this helps!
JavaStripped
&quot;I did *not* escape. They gave me a day pass.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top