by Christian Thompson.
Naturally, pretty much as soon as I submitted my post, I realized how to do it - using the click() method. I hope somebody else finds this useful. Take it easy and keep on Moodling!
//Check an unchecked checkbox isChecked=document.getElementsByName("availablefrom[enabled]")[0].checked;if(!isChecked){ document.getElementsByName("availablefrom[enabled]")[0].click();}