zoukankan      html  css  js  c++  java
  • C#-WebForm-纯HTML提交方式

    此方法常用于 纯.html页面向数据库添加数据

    在.aspx网页中可以通过传值的方式提交信息,如何在.html网页中提交数据?

    提交数据需要在同一个 form 中,用到两个属性:action、method

    action - 要提交的服务端  method - get/post

    html页面:

    李明泽

    复制代码
    <body>
        <form action="Default.aspx" method="get">
            <input type="text" name="t1" />+<input type="text" name="t2" />=<input type="text" />
            <input type="submit" value="计算" />
        </form>
    </body>
    复制代码

    aspx页面后台:

    复制代码
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int i1 = Convert.ToInt32(Request["t1"]);
            int i2 = Convert.ToInt32(Request["t2"]);
            string i3 = (i1 + i2).ToString();
    
            Response.Redirect("HtmlPage.html?=" + i3);
        }
    }
    复制代码

    存在问题:获取的结果,虽然传回.html页面地址栏,但由于.html无服务端,所有无法将返回的值传到textbox3中

  • 相关阅读:
    Tomcat:基础安装和使用教程
    java部署
    tomcat 配置访问路径 server.xml配置去掉项目名称 .
    linuxACL控制
    Your PHP installation appears to be missing the MySQL
    ssh报错
    502 Bad Gateway
    单点登录SSO
    tomcat详细介绍
    详解redis5.x版本
  • 原文地址:https://www.cnblogs.com/baimangguo/p/6380534.html
Copyright © 2011-2022 走看看