submit
前台<body>中的代码:
<body>
<div id="top"> </div>
<form id="login" name="login" action="?Action=Login" method="post">
<div id="center">
<div id="center_left"></div>
<div id="center_middle">
<div class="user">
<label>用户名:
<input type="text" name="UserName" id="UserName" />
</label>
</div>
<br />
<div class="user">
<label>密 码:
<input type="password" name="UserPassword" id="UserPassword" />
</label>
</div>
</div>
<div id="center_middle_right"></div>
<div id="center_submit">
<div class="button"> <img alt="" id="loginin" src="data:images/dl.gif" width="57" height="20" onclick="document.login.submit()"/> </div>
<div class="button"> <img alt="" id="loginreset" src="data:images/cz.gif" width="57" height="20" onclick="document.login.reset()"/> </div>
</div>
<div id="center_right"></div>
</div>
</form>
<div id="footer"></div>
</body>
通过图片的点击事件,执行form.submit()传递form中的参数。
后台cs代码:
protected string Action = "";
myBaseClass myData = new myBaseClass();
protected class UserLoginInfo
{
public string UserName = "";
public string UserPassword = "";
}
protected UserLoginInfo _UserLoginInfo = new UserLoginInfo();//创建对象 protected void Page_Load(object sender, EventArgs e)
{
Init_WebControls();
} public void Init_WebControls()
{
try
{
if (!string.IsNullOrEmpty(Request.QueryString["Action"]))//获取form的Action中的参数
{
Action = Request.QueryString["Action"].Trim().ToLower();//去掉空格并变小写
前台<body>中的代码:
<body>
<div id="top"> </div>
<form id="login" name="login" action="?Action=Login" method="post">
<div id="center">
<div id="center_left"></div>
<div id="center_middle">
<div class="user">
<label>用户名:
<input type="text" name="UserName" id="UserName" />
</label>
</div>
<br />
<div class="user">
<label>密 码:
<input type="password" name="UserPassword" id="UserPassword" />
</label>
</div>
</div>
<div id="center_middle_right"></div>
<div id="center_submit">
<div class="button"> <img alt="" id="loginin" src="data:images/dl.gif" width="57" height="20" onclick="document.login.submit()"/> </div>
<div class="button"> <img alt="" id="loginreset" src="data:images/cz.gif" width="57" height="20" onclick="document.login.reset()"/> </div>
</div>
<div id="center_right"></div>
</div>
</form>
<div id="footer"></div>
</body>
通过图片的点击事件,执行form.submit()传递form中的参数。
后台cs代码:
protected string Action = "";
myBaseClass myData = new myBaseClass();
protected class UserLoginInfo
{
public string UserName = "";
public string UserPassword = "";
}
protected UserLoginInfo _UserLoginInfo = new UserLoginInfo();//创建对象 protected void Page_Load(object sender, EventArgs e)
{
Init_WebControls();
} public void Init_WebControls()
{
try
{
if (!string.IsNullOrEmpty(Request.QueryString["Action"]))//获取form的Action中的参数
{
Action = Request.QueryString["Action"].Trim().ToLower();//去掉空格并变小写
}
switch (Action)
{
case "login":
if (!string.IsNullOrEmpty(Request.Form["UserName"]) && !string.IsNullOrEmpty(Request.Form["UserPassWord"]))//获取form中的参数
{
_UserLoginInfo.UserName = Request.Form["UserName"].ToString();
_UserLoginInfo.UserPassword = Request.Form["UserPassWord"].ToString();
string user = "select 管理员名称,密码 from T_管理员表 where 管理员名称='" + _UserLoginInfo.UserName + "' and 密码='" + _UserLoginInfo.UserPassword + "'";
if (myData.readDataSet(user).Tables[0].Rows.Count == 1)
{
Response.Redirect("Main.aspx", false);//防止Response.End 方法终止页的执行
}
else
{
Response.Write("<Script Language=JavaScript>alert('密码或用户名错误,请重试!');</Script>"); }
}
break;
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
} }
switch (Action)
{
case "login":
if (!string.IsNullOrEmpty(Request.Form["UserName"]) && !string.IsNullOrEmpty(Request.Form["UserPassWord"]))//获取form中的参数
{
_UserLoginInfo.UserName = Request.Form["UserName"].ToString();
_UserLoginInfo.UserPassword = Request.Form["UserPassWord"].ToString();
string user = "select 管理员名称,密码 from T_管理员表 where 管理员名称='" + _UserLoginInfo.UserName + "' and 密码='" + _UserLoginInfo.UserPassword + "'";
if (myData.readDataSet(user).Tables[0].Rows.Count == 1)
{
Response.Redirect("Main.aspx", false);//防止Response.End 方法终止页的执行
}
else
{
Response.Write("<Script Language=JavaScript>alert('密码或用户名错误,请重试!');</Script>"); }
}
break;
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
submit的更多相关文章
- submit text3常用快捷键
在网上找了一些submit text的快捷键: Ctrl+D 选词 (反复按快捷键,即可继续向下同时选中下一个相同的文本进行同时编辑)Ctrl+G 跳转到相应的行Ctrl+J 合并行(已选择需要合并的 ...
- jquery 通过submit()方法 提交表单示例
jquery 通过submit()方法 提交表单示例: 本示例:以用户注册作为例子.使用jquery中的submit()方法实现表单提交. 注:本示例仅提供了对表单的验证,本例只用选用了三个字段作为测 ...
- ABAP关键字SUBMIT的简单例子和学习小记
网上有关SUBMIT实现程序调用的例子稍显复杂,而相关的参考和解释则不是很完善.本文给出一个SUBMIT的小示例程序(代码见文末),实现了最简单的程序间调用及返回值,以及SAP官方文档中相关内容的翻译 ...
- 表单元素的submit()方法和onsubmit事件
1.表单元素中出现了name="submit"的元素 2.elemForm.submit();不会触发表单的onsubmit事件 3.动态创建表单时遇到的问题 表单元素拥有subm ...
- jquery.validate不用submit而用js提交的例子
$("#form").validate(); $("#btn).click(function(){ if($("#form").valid()){ $ ...
- from表单如果未指定action,submit提交时候会执行当前url
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- ExecutorService中submit()和execute()的区别
在使用java.util.concurrent下关于线程池一些类的时候,相信很多人和我一样,总是分不清submit()和execute()的区别,今天从源码方面分析总结一下. 通常,我们通过Execu ...
- 关于click和submit的笔记
click主要用于元素的点击时的响应事件,而submit是指表单元素form的提交事件. 但是,当click加入到表单的提交按钮时,事情似乎就有点复杂,总是忘记了.这两天搜了下,又实践了一下. 主要用 ...
- 关于在用curl函数post网页数据时,遇上表单提交 type为submit 类型而且没有name和id时可能遇到的问题及其解决方法
curl函数库实现爬网页内容的链接在 http://www.cnblogs.com/linguanh/p/4292316.html 下面这个是没有name和id 标识的 <input type= ...
- ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...
随机推荐
- JS实现设为首页与加入收藏
<script type="text/javascript"> // 设置为主页 function SetHome(obj, vrl) { try { obj.styl ...
- JAVA给图片加上水印
import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java ...
- 处理海量数据的高级排序之——归并排序(C++)
代码实现 ...
- 让wego微购购物分享系统采集拍拍数据功能之腾讯paipai功能采集插件
wego是一款很不错的导购系统,无论前后台设计风格和功能都还不错,可有时我们的确需要一些自定义的功能,毕竟万千世界,大家都做一样的东西,采集同样的数据,能不烦吗?哈哈,今天就奉献上一个wego拍拍采集 ...
- JQuery小结
一.选择网页元素 jQuery的基本设计和主要用法,就是"选择某个网页元素,然后对其进行某种操作".这是它区别于其他函数库的根本特点. 使用jQuery的第一步,往往就是将一个选择 ...
- Odoo 9 PDF不显示中文字体
在Ubuntu中安装中文字体: $ sudo apt-get install ttf-wqy-zenhei $ sudo apt-get install ttf-wqy-microhei
- mysql连接查询语句示例
eg: 内连接: select student.*,grade.* from student join grade where student.sid=grade.sid; selec ...
- ZK 父窗口与子窗口消息交互
父窗口代码: 前台(test.zul) <?page title="" contentType="text/html;charset=UTF-8"?> ...
- Rocky4.2下安装金仓v7数据库(KingbaseES)
1.准备操作系统 1.1 系统登录界面 1.2 操作系统版本信息 jdbh:~ # uname -ra Linux jdbh -x86_64 # SMP Fri Dec :: CST x86_64 G ...
- 微信公众号内H5调用微信支付国内服务商模式
最近在折微信公众号内H5用JSAPI调用微信支付,境内服务商版支付,微信支付给出的官方文档以及SDK不够详细,导至我们走了一些弯路,把他分享出来,我这边主要是用PHP开发,所以未加说的话示例都是PHP ...