Yep, your line of code is correct, and placing the JavaScript function below the <title></title> (and before the </head>) is OK.
There is a slight confusion with the checkbox() function name, though. I tried this and the page kept on reporting a JavaScript error. Change the name of the function to checkBox() - this did work, because JavaScript functions are case sensitive.
Slightly the wrong forum for JavaScript help but, heck, we're a friendly bunch !!