Setting “checked” for a checkbox in javascript?

document.getElementById("element_id").checked = true; // check
document.getElementById("element_id").checked = false; // uncheck