Setting/Resetting Checkboxes with a Single Click

I have a bunch of files on the server that I wanted to be able to select, for example, to delete them or to give them special treatment. Thus, I made a table with their names and a checkbox for each of them. However, I also want to be able to select/deselect _all_ of them with a single click. To do this, I use Javascript.