zoukankan      html  css  js  c++  java
  • 多表单提交

    控制器代码:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;
    using Mvc1.Models;
    
    namespace Mvc1.Controllers
    {
        public class HomeController : Controller
        {public ActionResult Other1()
            {
                return View();
            }
    
            public ActionResult FFF(string one, string two)
            {
                int end = Convert.ToInt32(one) + Convert.ToInt32(two);
    
                Session["end"] = end;
    
                return RedirectToAction("Other1");
            }
    
            public ActionResult GGG(string one, string two)
            {
                int end = Convert.ToInt32(one) - Convert.ToInt32(two);
    
                Session["end"] = end;
    
                return RedirectToAction("Other1");
            }
        }
    }

    界面代码:

    @{
        Layout = null;
    }
    
    <!DOCTYPE html>
    
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Other1</title>
    </head>
    <body>
        <div>
            <form id="form1" name="form1" method="post" action="FFF">
                <input type="text" name="one" />
                <input type="text" name="two" />
                <br />
                <input type="button" value="" name="btn1" onclick="form1.submit()" />
                <input type="button" value="" name="btn1" id="jian" />
            </form>
            @{
                if (Session["end"] != null)
                {
                <span>@Session["end"].ToString()</span>
                    Session["end"] = null;
                }
            }
        </div>
    </body>
    </html>
    <script type="text/javascript">
        document.getElementById('jian').onclick = function () {
            document.getElementById('form1').action = "GGG";
            form1.submit();
        };
    
    </script>
  • 相关阅读:
    父div不会被子div撑高
    ie6兼容问题
    浏览器兼容性技巧
    css hack基本语法
    网站设置为灰色
    .net cookie跨域请求指定请求域名
    实体对象属性和值转为键值对Dictionary
    C#通过对象属性名修改值
    jQuery.noConflict()解决imgBox.js依赖jquery版本问题
    华为OJ之最长公共子序列
  • 原文地址:https://www.cnblogs.com/123lucy/p/5828690.html
Copyright © 2011-2022 走看看