asp.net中form表单问题
html页面
<form id="submitForm" action="leave.ashx" method="post">您的真实姓名:<input type="text" id="realName" name="realName" /><input type="submit" value="测试" /></form> <script>function leave(des){ //这里测试用只有弹框,实质上需要做其他html页面上的处理 alert(des);}</script>
<%@ WebHandler Language="C#" Class="leave" %>using System;using System.Web;using System.Data.OleDb;using System.Data;using System.Web.SessionState;using System.Text;public class leave : IHttpHandler, IReadOnlySessionState{ public void ProcessRequest(HttpContext hc) { hc.Response.ContentType = "text/html"; hc.Response.Charset = "UTF-8"; string realName = hc.Request.Form["realName"].ToString(); string str = "提交成功!"; hc.Response.Write("<script language='javascript' type='text/javascript'>leave('" + str + "');</script>"); hc.Response.End(); } public bool IsReusable { get { return false; } }}