js中的方法任意删除一两个就能运行,那说明jquery的路径没问题,方法也没错,可是只要多写几个方法就不能运行了,是什么原因?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../work/js/jquery-1.7.2.min.js"></script>
<title>无标题文档</title>
</head>
<body>
<div style="height:300px; width:400px; border:#33F solid 5px; background:#C9C9E7; margin:100px auto" >
<center>
<form id="f1" action="http://localhost:8080/WEB/User?action=Register" method="post" style="margin:30px" enctype="multipart/form-data">
<div style="float:left">
账户昵称:<input type="text" name="unickname" onchange="cnickname()"/>
</div>
<div>
<img src="../work/image/right.png" class="right1"; width="17"; height="17";/>
<img src="../work/image/wrong.png" class="wrong1"; width="17"; height="17";/>
</div>
<div style="float:left">
登录邮箱:<input type="text" name="uemailaddr" onchange="cemailaddr()"/>
</div>
<div>
<img src="../work/image/right.png" class="right2"; width="17"; height="17";/>
<img src="../work/image/wrong.png" class="wrong2"; width="17"; height="17";/>
</div>
<div style="float:left">
登录密码:<input type="password" name="upassword" onchange="cpassword()"/>
</div>
<div>
<img src="../work/image/right.png" class="right3"; width="17"; height="17";/>
<img src="../work/image/wrong.png" class="wrong3"; width="17"; height="17";/>
</div>
<div style="float:left">
确认密码:<input type="password" name="uconfirm" onchange="cconfirm()"/>
</div>
<div>
<img src="../work/image/right.png" class="right4"; width="17"; height="17";/>
<img src="../work/image/wrong.png" class="wrong4"; width="17"; height="17";/>
</div>
<div>
<input type="submit" value="注册" onclick="subconfirm()"/>
<input type="button"
onclick="window.location.href='http://localhost:8080/WEB/User?action=LoginShow'"
value="登录"/>
</div>
</form>
</center>
</div>
</body>
</html>
<script>
alert("1");
hideall();
alert("2");
function hideall()
{
$(".wrong1").hide();
$(".right1").hide();
$(".wrong2").hide();
$(".right2").hide();
$(".wrong3").hide();
$(".right3").hide();
$(".wrong4").hide();
$(".right4").hide();
}
function cnickname(){ //校验nickname
var nick=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/; //大小写字母开头,允许5-20字节,允许字母数字下划线
var value=$("input[name='unickname']").val();
if (nick.test(value) == true) {
$(".wrong1").hide();
$(".right1").show();
}
else{ $(".right1").hide();
$(".wrong1").show();
}
};
function cemailaddr(){ //校验uemailaddr
var email=/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
var value=$("input[name='uemailaddr']").val();
if (email.test(value) == true) {
$(".wrong2").hide();
$(".right2").show();
}
else{ $(".right2").hide();
$(".wrong2").show();
}
};
function cpassword(){ //校验password
var pwd=/^(\w){6,20}$/; //校验密码:只能输入6-20个字母、数字、下划线
var value=$("input[name='upassword']").val();
if (pwd.test(value) == true) {
$(".wrong3").hide();
$(".right3").show();
}
else{ $(".right3").hide();
$(".wrong3").show();
}
};
function cconfirm(){ //确认密码一致
if ($("input[name='upassword']").val()==$("input[name='uconfirm']").val() ) {
$(".wrong4").hide();
$(".right4").show();
}
else{ $(".right4").hide();
$(".wrong4").show();
}
};
自己答吧,想了两天,刚才突然想到了,在java里面用文件流定义字节数组的时候把文件限制在了4k,改大了就好了。
厉害了。 验证可以试着用jq的validate。 我觉得不错