Maybe the following page can help to solve the problem:
If I understand it correctly they say there that "this" in your example
refers to the "window" and not to the "checkbox".
Having read the document, I don't think this is the problem.
Anyone have experience using 'this.' in Jmol.js checkbox scripts to Jmol? At this point, I've worked around the problem, but would still like to know how for next time.