At first you would think you could just update a variable "lastChecked" whenever a checkbox is checked, but since users have the ability to
uncheck checkboxes, you'd have to keep a history of what boxes they've checked. That way, if they uncheck the last box they checked, the "lastChecked" variable could be updated to the last box they checked that is
still checked. The psuedo code would look like this:
declare an array to keep the history of boxes checked
On click event of checkbox
if box is being checked
append the id of the box to the history array
else if box is being unchecked
loop through the history array
remove the item from the array if found
On submit event of the form
set hidden form field to last history array item
You weren't specific, so I'm guessing you're using a separate page to process the form. When the form is done being processed, redirect back to the form - adding the id of the box last checked to the url.
On load of the form
extract the id from the url
find the checkbox that matches the id extracted
either loop through the form elements or
use the getElementByID() method
set the focus on the box Adam