Tiny fixes suggested by Kirupa

* Put JS open braces on the same line as the statement
* Use 'querySelector' instead of 'getElementByID'
* A few other tiny fixes