<script type="text/javascript">
$(function () {
$("form :input").blur(function {
var $parent = $(this).parent();
var $pare = $parent.parent();
$pare.find(".formtips").remove();
//验证用户名
if ($(this).is("#<%= txtName.ClientID%>,#<%=txtPwd.ClientID%>,#<%= txtRePwd.ClientID%>,#<%= txtMemberName.ClientID%>,#<%= txtTell.ClientID%>,#<%= txtMobile.ClientID%>,#<%= txtAddress.ClientID%>,#<%= txtEmail.ClientID%>,#<%= txtCarNumber.ClientID%>,#<%=txtRePwd.ClientID%>")) {
if (this.value == "" || this.value.length < 6) {
var errorMsg = '此为必填项.';
$(this).parent().next().append('<span class="formtips onError">' + errorMsg + '</span>');
return false;
} else {
var okMsg = '输入正确.';
$(this).parent().next().append('<span class="formtips onSuccess">' + okMsg + '</span>');
}
}
//验证重复密码
if ($(this).is("#<%=txtRePwd.ClientID%>")) {
if (this.value != $("#<%= txtPwd.ClientID%>").val()) {
var errorMsg = "两次输入的密码不一致";
$pare.find(".formtips").remove();
$(this).parent().next().append('<span class="formtips onError">' + errorMsg + '</span>');
return false;
} else {
var okMsg = '输入正确.';
$pare.find(".formtips").remove();
$(this).parent().next().append('<span class="formtips onSuccess">' + okMsg + '</span>');
}
}
}).keyup(function() {
$(this).triggerHandler("blur");
}) //end blur
})
</script>
应该怎么改????
$(function () {
$("form :input").blur(function {
var $parent = $(this).parent();
var $pare = $parent.parent();
$pare.find(".formtips").remove();
//验证用户名
if ($(this).is("#<%= txtName.ClientID%>,#<%=txtPwd.ClientID%>,#<%= txtRePwd.ClientID%>,#<%= txtMemberName.ClientID%>,#<%= txtTell.ClientID%>,#<%= txtMobile.ClientID%>,#<%= txtAddress.ClientID%>,#<%= txtEmail.ClientID%>,#<%= txtCarNumber.ClientID%>,#<%=txtRePwd.ClientID%>")) {
if (this.value == "" || this.value.length < 6) {
var errorMsg = '此为必填项.';
$(this).parent().next().append('<span class="formtips onError">' + errorMsg + '</span>');
return false;
} else {
var okMsg = '输入正确.';
$(this).parent().next().append('<span class="formtips onSuccess">' + okMsg + '</span>');
}
}
//验证重复密码
if ($(this).is("#<%=txtRePwd.ClientID%>")) {
if (this.value != $("#<%= txtPwd.ClientID%>").val()) {
var errorMsg = "两次输入的密码不一致";
$pare.find(".formtips").remove();
$(this).parent().next().append('<span class="formtips onError">' + errorMsg + '</span>');
return false;
} else {
var okMsg = '输入正确.';
$pare.find(".formtips").remove();
$(this).parent().next().append('<span class="formtips onSuccess">' + okMsg + '</span>');
}
}
}).keyup(function() {
$(this).triggerHandler("blur");
}) //end blur
})
</script>
应该怎么改????
在提交按钮的OnClientClick的属性写上OnClientClick="return Checked()"