Subj.
For example...
<a href="#" act="check_all" with="category_checkbox">Check all</a>
<p>
<input type="checkbox" name="category[1]" tag="category_checkbox" /> Category 1
<input type="checkbox" name="category[2]" tag="category_checkbox" /> Category 2
</p>
PS: What advantages and disadvantages of this method? Please explain why. By the way, if you are using only id,classes for selecting items. please describe what names you are using for it?