Checkbox Widget for HTML

Services
Products
Contact us
Karoo Project
Docs
Index
ZWARTBERG Research & Development

checkbox

HTML

A checkbox is just an input element with type="checkbox". In this case the widget library just makes it conformant to the style of the rest of the widgets.

<input type="checkbox" checked="checked"/>
<!-- widget checkbox action:myCheckboxAction; -->
	    

Javascript

The "action:myCheckboxAction" in the above example causes a javascript function to be called when the checkbox is toggled. The "action" property specifies the name of the function, in this case: "myCheckboxAction"

The function is called, and passed the HTML element that was clicked. E.g. the following Javascript function is called when the example on this page is clicked:

function myCheckboxAction(target)
{
    alert("toggled "+elementToString(target)+"\n checked="+target.checked);
}
	    

(The elementToString function is a convenience function supplied with the widget library for debugging purposes).

There is also a Javascript function mechanism for setting the checked state of the checkbox, E.g. (assuming that the "elem" variable was assigned to the checkbox:

elem.checked = false;
	    

CSS

At present, the checkbox widget does not use any special CSS class. In future, we plan to use other HTML elements (than just input) to create a checkbox, and then, special CSS classes will apply.

More...

Documentation     Other widgets

Zwartberg Reseach & Development is a registered trading name of Open Source Software Consulting CC.
Phone:+27235411462, fax:+27235411379, mobile:+27796977082,
brian@zwartberg.com, P.O. Box 2, Prince Albert, 6930, South Africa.

Valid XHTML 1.0 Transitional