JavaScript中指示输入的值是否有效用什么方法?

来源:百度知道 编辑:UC知道 时间:2024/05/09 20:47:41

<script Language="JavaScript">
function ChkFields() {
if (document.form1.username.value=='') {
window.alert ("用户名不能为空!");
form1.username.focus();
return false
}
if (document.form1.email.value.length<6) {
window.alert ("EM长度不少于6位!");
form1.email.focus();
return false
}if
return true
}
</script>