<form>
    <p><label><input type="checkbox" id="enable"> Enable?</label></p>
    <p><input type="text" id="text"></p>
</form>
var checkbox = document.getElementById('enable');
var textInput = document.getElementById('text');
textInput.disabled = true;
checkbox.onchange = function() {
    textInput.disabled = !checkbox.checked;
};