<!DOCTYPE html>
<html>
<body>
<p>Enter a number and click Here Button:</p>
<input id="1" type="number" min="5" max="10" required>
<button onclick="myFunction()">OK</button>
<p>If the number is less than 5 or greater than 10, an error message will be displayed.</p>
<p id="test"></p>
<script>
function myFunction() {
var inpObj = document.getElementById("1");
if (!inpObj.checkValidity()) {
document.getElementById("test").innerHTML = inpObj.validationMessage;
} else {
document.getElementById("test").innerHTML = "OK";
}
}
</script>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
JavaScript Validation API with DOM.zip
共1个文件
html:1个
需积分: 5 0 下载量 169 浏览量
2023-11-08
19:45:55
上传
评论
收藏 499B ZIP 举报
温馨提示
JavaScript Validation API with DOM
资源推荐
资源详情
资源评论
收起资源包目录
JavaScript Validation API with DOM.zip (1个子文件)
test.html 707B
共 1 条
- 1
资源评论
sanbaofengs
- 粉丝: 507
- 资源: 711
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功