本地測試提示信息為什么是英文???
<!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" />
<title>validate</title>
<link href="style2.css" rel="stylesheet" type="text/css" />
? ? <script src="jquery 1.12.2.js" type="text/javascript"></script>
? ? <script src="jquery.validate.js" type="text/javascript"></script>
? ? <script src="additional-methods2.js" type="text/javascript"></script>
</head>
<body>
<form id="frmV" method="get" action="#">
? ? <div id="divtest">
? ? ? ? <div class="title">
? ? ? ? ? ? <span class="fl">表單驗(yàn)證插件</span>
? ? ? ? ? ? ? ? <span class="fr">
? ? ? ? ? ? ? ? <input id="btnSubmit" type="submit" value="提交" />
? ? ? ? ? ? ? ? </span>
? ? ? ? ? ? </div>
? ? ? ? ? ? <div class="content">
? ? ? ? ? ? <span class="fl">郵箱:</span><br />
? ? ? ? ? ? ? ? <input id="email" name="email" type="text" /><br />
? ? ? ? ? ? ? ? <span class="tip"></span>
? ? ? ? ? ? </div>
? ? ? ? </div>
? ? </form>
? ??
? ??
? ? <script type="text/javascript">
? ? $(function(){
$("#frmV").validate({
//自定義驗(yàn)證規(guī)則
rules:{
email:{
required:true,
email:true
}
},
//錯誤提示位置
errorPlacement:function(error,element){
error.appendTo(".tip");
}
});
});
? ? </script>
? ??
? ??
</body>
</html>
-------------------------
// JavaScript Document/*
?/* Translated default messages for the jQuery validation plugin.
?* Language: CN
?* Author: Fayland Lam <fayland at gmail dot com>
?*/
jQuery.extend(jQuery.validator.messages, {
? ? ? ? required: "必選字段",
remote: "請修正該字段",
email: "請輸入正確格式的電子郵件",
url: "請輸入合法的網(wǎng)址",
date: "請輸入合法的日期",
dateISO: "請輸入合法的日期 (ISO).",
number: "請輸入合法的數(shù)字",
digits: "只能輸入整數(shù)",
creditcard: "請輸入合法的信用卡號",
equalTo: "請再次輸入相同的值",
accept: "請輸入擁有合法后綴名的字符串",
maxlength: jQuery.format("請輸入一個長度最多是 {0} 的字符串"),
minlength: jQuery.format("請輸入一個長度最少是 {0} 的字符串"),
rangelength: jQuery.format("請輸入一個長度介于 {0} 和 {1} 之間的字符串"),
range: jQuery.format("請輸入一個介于 {0} 和 {1} 之間的值"),
max: jQuery.format("請輸入一個最大為 {0} 的值"),
min: jQuery.format("請輸入一個最小為 {0} 的值")
});
-------------------------
@charset "utf-8";
/* CSS Document */
@charset "utf-8";
/* CSS Document */
#divtest
{
? ? width: 282px;
}
#divtest .title
{
? ? padding: 8px;
? ? background-color:Blue;
? ? color: #fff;
? ? height: 23px;
? ? line-height: 23px;
? ? font-size: 15px;
? ? font-weight: bold;
}
#divtest .content
{
? ? padding: 8px 0px;
? ? background-color: #fff;
? ? font-size: 13px;
}
#divtest .content .tip
{
? ? color:red;
? ? font-size: 12px;
}
.fl
{
? ? float: left;
}
.fr
{
? ? float: right;
}
------------------------------
本地測試提示信息為什么是英文?我已經(jīng)引入了"additional-methods2.js"啊。
2016-05-02
你到9-1的那節(jié)去看一下,有一個插件你沒有加,在練習(xí)的代碼里加了一個提示信息顯示為中文的插件
<script type="text/javascript" src="http://idcbgp.cn/data/jquery.validate.messages_cn.js"></script>
cn代表中文