要检查是否选中了复选框,请尝试运行以下代码。如果选中此复选框,则返回true,否则返回false-
<html> <head> <script> function myFunction(){ var result = document.getElementById("check").checked; alert(result); } </script> </head> <body> <label><input id="check" type="checkbox" >One</label><br> <button onclick="myFunction()">Check value</button> </body> </html>