<html>
<body>
复选框:<input type="checkbox" id="myCheck" value="myvalue">
<p>单击下面的按钮可显示和/或更改上面复选框的 value 属性的值。</p>
<button onclick="display()">显示值</button>
<button onclick="change()">修改值</button>
<script>
function display() {
var x = document.getElementById("myCheck").value;
alert("复选框的值是:" + x);
}
function change() {
var x = document.getElementById("myCheck").value = "newCheckboxValue";
alert ("该值已更改为:" + x);
}
</script>
</body>
</html>