Just call this function on a handler of the event
onclick
of the check box. Please see:
http://www.w3schools.com/jsref/dom_obj_event.asp[
^].
<input type="checkbox" id="<%=aspossible.ClientID%>" onclick="ascheckpossible()" />
Also, call this function to initialize visibility and other setting according to the initial state of your check box.
This is very convenient to do with jQuery. It produces much more compact and easy-to-support code. Please see:
http://en.wikipedia.org/wiki/JQuery[
^],
http://jquery.com/[
^],
http://docs.jquery.com/How_jQuery_Works[
^],
http://api.jquery.com/category/selectors/[
^],
http://api.jquery.com/category/events/[
^],
http://api.jquery.com/category/attributes/[
^].
Two last links embrace all library features you need to know to solve you simple problem: selectors would replace
document.getElementById
and return jQuery wrappers to any element, and events would replace event properties and handler calls, using attribute functions. All the code is usually written as a single handler of the
$(document).ready
event:
$(document).ready(function() {
myCheckBox = $("#<%=aspossible.ClientID%>");
myCheckBox.
myCheckBox.click(function() {
})
});
—SA