js提交表单
<head>
<title></title>
<script type="text/javascript">
function bt() {
document.getElementById("f").submit();
}
</script>
</head>
<body>
<form id="f" action="Default.aspx" method="post" >
<table>
<tr><td>yonghuming</td><td>
<input id="Text1" name="t1" type="text" /></td></tr>
<tr><td>mima</td><td>
<input id="Text2" name="t2" type="text" /></td></tr>
<tr><td></td><td></td></tr>
<tr><td>
</td><td></td></tr>
</table></form>
<input id="Button1" type="button" value="button" οnclick="bt()" />
</body>
</html>
使用提示,直接form表单提交
<form action="Default.aspx" method="post" id="f1">
<table>
<tr><td>用户名</td><td>
<input id="Text1" name="T1" type="text" /></td></tr>
<tr><td>密码</td><td>
<input id="Text2" name="T2" type="text" /></td></tr>
<tr><td>
<input type="submit" name="submit1" value="提交" οnclick="if(confirm('确认要提交表单吗'))this.f1.submit()"></td></tr>
</table>
</form>
if (HttpContext.Current.Request.HttpMethod == "POST")//是否为POST的传值方式
{
string 客户编号 = Request.Form["Text1"].ToString();
string 公司名称 = Request.Form["Text2"].ToString();
string 联系人 = Request.Form["Text3"].ToString();
string 性别 = Request.Form["Text4"].ToString();
string 电话 = Request.Form["Text5"].ToString();
string 客户等级 = Request.Form["Text6"].ToString();
string 地址 = Request.Form["Text7"].ToString();
string 备注 = Request.Form["Text8"].ToString();
my.sqldelete("update clientinformation set 公司名称='" + 公司名称 + "',联系人='" + 联系人 + "',性别='" + 性别 + "',电话='" + 电话 + "',客户等级='" + 客户等级 + "',地址='" + 地址 + "',备注='" + 备注 + "' where 客户编号='" + 客户编号 + "'");
Response.Redirect("index.aspx");
}
JQUERY提交表单
function checksubmit(){
$("#form1").submit();
}
ajax提交表单
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#myFormId').ajaxForm(function() {
$(this).ajaxSubmit();
});
});
</script>
<form id="myForm" action="Default.aspx" method="post">
民资 <input type="text" id="t1" name="t1" />
<input type="submit" value="登录"/>
</form>
ajax验证用户名是否填
<form id="validationForm" action="dummy.php" method="post">
Username: <input type="text" name="username" />
Password: <input type="password" name="password" />
<input type="submit" value="Submit" />
</form>
$(document).ready(function() {
// bind form using ajaxForm
$('#myForm2').ajaxForm( { beforeSubmit: validate } );
});
function validate(formData, jqForm, options) {
// formData is an array of objects representing the name and value of each field
// that will be sent to the server; it takes the following form:
//
// [
// { name: username, value: valueOfUsernameInput },
// { name: password, value: valueOfPasswordInput }
// ]
//
// To validate, we can examine the contents of this array to see if the
// username and password fields have values. If either value evaluates
// to false then we return false from this method.
for (var i=0; i < formData.length; i++) {
if (!formData[i].value) {
alert('Please enter a value for both Username and Password');
return false;
}
}
alert('Both fields contain values.');
}
<head>
<title></title>
<script type="text/javascript">
function bt() {
document.getElementById("f").submit();
}
</script>
</head>
<body>
<form id="f" action="Default.aspx" method="post" >
<table>
<tr><td>yonghuming</td><td>
<input id="Text1" name="t1" type="text" /></td></tr>
<tr><td>mima</td><td>
<input id="Text2" name="t2" type="text" /></td></tr>
<tr><td></td><td></td></tr>
<tr><td>
</td><td></td></tr>
</table></form>
<input id="Button1" type="button" value="button" οnclick="bt()" />
</body>
</html>
使用提示,直接form表单提交
<form action="Default.aspx" method="post" id="f1">
<table>
<tr><td>用户名</td><td>
<input id="Text1" name="T1" type="text" /></td></tr>
<tr><td>密码</td><td>
<input id="Text2" name="T2" type="text" /></td></tr>
<tr><td>
<input type="submit" name="submit1" value="提交" οnclick="if(confirm('确认要提交表单吗'))this.f1.submit()"></td></tr>
</table>
</form>
if (HttpContext.Current.Request.HttpMethod == "POST")//是否为POST的传值方式
{
string 客户编号 = Request.Form["Text1"].ToString();
string 公司名称 = Request.Form["Text2"].ToString();
string 联系人 = Request.Form["Text3"].ToString();
string 性别 = Request.Form["Text4"].ToString();
string 电话 = Request.Form["Text5"].ToString();
string 客户等级 = Request.Form["Text6"].ToString();
string 地址 = Request.Form["Text7"].ToString();
string 备注 = Request.Form["Text8"].ToString();
my.sqldelete("update clientinformation set 公司名称='" + 公司名称 + "',联系人='" + 联系人 + "',性别='" + 性别 + "',电话='" + 电话 + "',客户等级='" + 客户等级 + "',地址='" + 地址 + "',备注='" + 备注 + "' where 客户编号='" + 客户编号 + "'");
Response.Redirect("index.aspx");
}
JQUERY提交表单
function checksubmit(){
$("#form1").submit();
}
ajax提交表单
<script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#myFormId').ajaxForm(function() {
$(this).ajaxSubmit();
});
});
</script>
<form id="myForm" action="Default.aspx" method="post">
民资 <input type="text" id="t1" name="t1" />
<input type="submit" value="登录"/>
</form>
ajax验证用户名是否填
<form id="validationForm" action="dummy.php" method="post">
Username: <input type="text" name="username" />
Password: <input type="password" name="password" />
<input type="submit" value="Submit" />
</form>
$(document).ready(function() {
// bind form using ajaxForm
$('#myForm2').ajaxForm( { beforeSubmit: validate } );
});
function validate(formData, jqForm, options) {
// formData is an array of objects representing the name and value of each field
// that will be sent to the server; it takes the following form:
//
// [
// { name: username, value: valueOfUsernameInput },
// { name: password, value: valueOfPasswordInput }
// ]
//
// To validate, we can examine the contents of this array to see if the
// username and password fields have values. If either value evaluates
// to false then we return false from this method.
for (var i=0; i < formData.length; i++) {
if (!formData[i].value) {
alert('Please enter a value for both Username and Password');
return false;
}
}
alert('Both fields contain values.');
}