html:
<form>
<p>
<label><input id="checkbox" type="checkbox" name="rule">核对信息</label>
</p>
<p><label><input id="submit" type="submit" value="提交"></label></p>
</form>
js:
<script>
window.onload=function(){
/*在gameid增加对检查按钮的验证*/
var submitBtn = document.getElementById("submit");
submitBtn.onclick = function () {
if(!document.getElementById("checkbox").checked) {
alert("请核对信息,并勾选按钮!");
return false;
}
};
}
</script>
```
本文介绍了一个简单的HTML表单,包含一个核对信息的勾选框和一个提交按钮。通过JavaScript实现了对勾选框的验证,确保用户在提交前已阅读并核对了信息。
4953

被折叠的 条评论
为什么被折叠?



