前台<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的更多相关文章

  1. submit text3常用快捷键

    在网上找了一些submit text的快捷键: Ctrl+D 选词 (反复按快捷键,即可继续向下同时选中下一个相同的文本进行同时编辑)Ctrl+G 跳转到相应的行Ctrl+J 合并行(已选择需要合并的 ...

  2. jquery 通过submit()方法 提交表单示例

    jquery 通过submit()方法 提交表单示例: 本示例:以用户注册作为例子.使用jquery中的submit()方法实现表单提交. 注:本示例仅提供了对表单的验证,本例只用选用了三个字段作为测 ...

  3. ABAP关键字SUBMIT的简单例子和学习小记

    网上有关SUBMIT实现程序调用的例子稍显复杂,而相关的参考和解释则不是很完善.本文给出一个SUBMIT的小示例程序(代码见文末),实现了最简单的程序间调用及返回值,以及SAP官方文档中相关内容的翻译 ...

  4. 表单元素的submit()方法和onsubmit事件

    1.表单元素中出现了name="submit"的元素 2.elemForm.submit();不会触发表单的onsubmit事件 3.动态创建表单时遇到的问题 表单元素拥有subm ...

  5. jquery.validate不用submit而用js提交的例子

    $("#form").validate(); $("#btn).click(function(){ if($("#form").valid()){ $ ...

  6. from表单如果未指定action,submit提交时候会执行当前url

    <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...

  7. ExecutorService中submit()和execute()的区别

    在使用java.util.concurrent下关于线程池一些类的时候,相信很多人和我一样,总是分不清submit()和execute()的区别,今天从源码方面分析总结一下. 通常,我们通过Execu ...

  8. 关于click和submit的笔记

    click主要用于元素的点击时的响应事件,而submit是指表单元素form的提交事件. 但是,当click加入到表单的提交按钮时,事情似乎就有点复杂,总是忘记了.这两天搜了下,又实践了一下. 主要用 ...

  9. 关于在用curl函数post网页数据时,遇上表单提交 type为submit 类型而且没有name和id时可能遇到的问题及其解决方法

    curl函数库实现爬网页内容的链接在 http://www.cnblogs.com/linguanh/p/4292316.html 下面这个是没有name和id 标识的 <input type= ...

  10. ABAP程序互调用:SUBMIT、CALL TRANSACTION、LEAVE TO TRANSACTION

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

随机推荐

  1. highcharts 时间少8小时问题

    Highcharts 中默认开启了UTC(世界标准时间),由于中国所在时区为+8,所以经过 Highcharts 的处理后会减去8个小时. 如果不想使用 UTC,有2种方法可供使用: 1.在使用Hig ...

  2. CoreJava知识点1

    一.基础 1.Java最大特点:开源open 2.J2EE由表示层.业务层.数据层组成 3.环境变量:javahome:JDK的安装路径 path:%javahome%\bin  ——虚拟机 执行命令 ...

  3. jsp页面价格

    <div class='flo_left'> <h2 class='red'>订货价¥${productEntity.agentsPrice}</h2> <h ...

  4. 读《深入php面向对象、模式与实践》有感(二)

    书中关于设计模式的介绍很详细. 一.单例模式 作者建了一个preferences类来解释什么是单例模式.这个preferences类并非我第一次见到,在android中也有这个类,不过以前都是只管用即 ...

  5. width,clientWidth,offsetWidth

    <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...

  6. mpdf部署到linux环境中遇到的问题

    首先遇到的问题未:Error - mPDF requires mb_string functions. Ensure that PHP is compiled with php_mbstring.dl ...

  7. NeuSoft(4)编写字符设备驱动

    1.要求:实现简单的字符设备驱动程序 2.源码清单 #include <linux/module.h> #include <linux/types.h> #include &l ...

  8. Android SDK 镜像站

    Android SDK镜像的介绍使用  http://www.androiddevtools.cn 镜像站地址   由于一些原因,Google相关很多服务都无法访问,所以在很多时候我们SDK也无法升级 ...

  9. mysql维护常用命令

    mysql一个字段的值是将其他字段的被容链接一块 UPDATE `tablename` SET 字段1=CONCAT(字段2," ",字段3," ",字段4) ...

  10. linux同步系统时间

    命令:ntpdate 路径:/usr/sbin/ntpdate 例子:ntpdate us.pool.ntp.org 查看日期时间命令:date 修改日期时间命令:date -s "2012 ...