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>
  • 相关阅读:
    android 之 ListView相关
    android 之 菜单
    android 之 Dialog
    android 之 View
    android 之 service
    android 之 Intent、broadcast
    Service Broadcast简单音乐播放功能
    剑指offer面试题43:n个筛子的点数
    C# LINQ语法
    C# Linq
  • 原文地址:https://www.cnblogs.com/123lucy/p/5828690.html
Copyright © 2011-2022 走看看