日期:2014-05-16 浏览次数:20346 次
<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<script src="@Url.Content("~/Scripts/jquery-1.8.0.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
<script type="text/javascript">
function Validate() {
if ($("form").valid()) {
$("form").trigger("submit");
}
}
</script>
</head>
<body>
<div>
<form>
<label>用户民:</label>
<input type="text" id="txtUser" name="txtUser" data-val="true" data-val-required="请输入用户名!" />
<span data-valmsg-for="txtUser"></span>
</form>
</div>
<input type="button" value="验证" onclick="Validate();" />
</body>
</html>