表单验证
<script>
function showTips(id,info){
document.getElementById(id+"span").innerHTML="<font color=‘red‘>"+info+"</font>"
}
//onblur="check(‘user‘,‘用户名不能为空‘)"
function check(id,info){
var el = document.getElementById(id).value;
//校验
if(el==""){
document.getElementById(id+"span").innerHTML="<font color=‘red‘>"+info+"</font>"
}else{
document.getElementById(id+"span").innerHTML="";
}
}
</script>
原文地址:https://www.cnblogs.com/lijun6/p/10455328.html
时间: 2024-10-12 05:06:07