I am not sure that I understand that. onclick only works onclick (an actual click), not if the checkmark is changed programatically. onchange does not apply to checkboxes. I think you are trying to do something which cannot be achieved.
You will have to use a button and a separate function to fire all the currently checked checkboxes if that is what you want.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 02-12-2013 at 05:57 PM..