js表单超过字数弹出提示,js表单低于字数弹出提示,javascript,ajax,html,网
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>表单验证</title>
</head>
<body>
<input type="text" id="name"><input type="button" onclick="poving()" value="提交">
<script type="text/javascript">
function poving(){
var username = document.getElementById("name");
if (username.value.length < 6) {
alert("不能小于6位");
}
else
if (username.value.length > 16) {
alert("不能大于16位");
}
}
</script>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>表单验证</title>
</head>
<body>
<input type="text" id="name"><input type="button" onclick="poving()" value="提交">
<script type="text/javascript">
function poving(){
var username = document.getElementById("name");
if (username.value.length < 6) {
alert("不能小于6位");
}
else
if (username.value.length > 16) {
alert("不能大于16位");
}
}
</script>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询