x
 
<!DOCTYPE html>
<html>
<body>
复选框:<input type="checkbox" id="myCheck" value="myvalue">
<p>请点击“试一试”按钮,显示复选框的 value 属性的值。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myCheck").value;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>