<html><body><p>选中复选框时显示一些文本:</p><label for="myCheck">复选框:</label> <input type="checkbox" id="myCheck" onclick="myFunction()"><p id="text" style="display:none">复选框已选中!</p><script>function myFunction() { var checkBox = document.getElementById("myCheck"); var text = document.getElementById("text"); if (checkBox.checked == true){ text.style.display = "block"; } else { text.style.display = "none"; }}</script></body></html>