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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do something with a checkbox

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
Hello,

How do I get a response from a checkbox. For example I have a checkbox and I want it to return a value to a javascript method. What I have done is this ;

<form onclick = &quot;setDisplayTime()&quot;>
<p class=&quot;left&quot;>
Show date and time in status bar:
<input type = &quot;checkbox&quot; checked = &quot;checked&quot; name =&quot;set display&quot; value = &quot;&quot; />
</form>

What this does is call a method whenever I click on an 'element of the form'. How do I call the method when the checkbox is checked or unchecked by the user passing a value true of false to the method?

Thanks in advance,

Chris
 
hie
may be
<form>
set display<input type=&quot;checkbox&quot; name =&quot;set_display&quot; onclick=&quot;jsmethod(this.checked)&quot; value = &quot;&quot; checked>
</form>
???
note:
never use spaces in ids/names
regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top