<!DOCTYPE html>
<html>
<body>

A Checkbox: <input type="checkbox" id="myCheck" value="myvalue">

<p>Click the buttons below to display and/or change the value of the value attribute of the checkbox above.</p>

<button onclick="display()">Display name</button>
<button onclick="change()">Change name</button>

<script>
function display() {
    var x = document.getElementById("myCheck").value;
    alert("The value of the checkbox is: " + x);
}

function change() {
    var x = document.getElementById("myCheck").value = "newCheckboxValue";
    alert ("The value was changed to: " + x);
}
</script>

</body>
</html>