<!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=gb2312" />
<title>无标题文档</title>
<script src="jquery.min.js"></script>
<script src="jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var options={
target:"#output1",
success:function(reponseText,statusText){alert(reponseText);alert(statusText);},
beforeSubmit:function(formData){
for(var i=0;i<formData.length;i++)
{
if(!formData[i].value)
{
alert("不能为空!");
return false;
}
}
return true;
},
clearForm:true
};
$("#myForm").ajaxForm(options);
});
</script>
</head>
<body>
<h3> form插件的使用--ajaxForm(). </h3>
<form id="myForm" action="form3.aspx" method="get">
名称: <input type="text" name="name" /> <br/>
密码: <input type="text" name="pwd" /><br/>
<input type="submit" id="test" value="提交" /> <br/>
<div id="output1"></div>
</form>
</body>
</html>
服务器文件:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@ Import Namespace="System.Data" %>
<%
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma","no-cache");
Response.Write("User:" + Request["name"] + " Password:" + Request["pwd"]);
%>