zoukankan      html  css  js  c++  java
  • 表单与JQuery

    表单:
    Html标签注意:
    1.提交action
    2.提交按钮:类型一定为type="submit" ,不然无反应
    3.
    Jquery: 个人认为属于JS
    1.一般不用表单提交
    2.直接onClick提交给JS中的Jquery,在由Jquery提交给后台并接收Json返回值
    =====================================================================================================
    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ViewMasterPageAdmin.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
    <%@ Import Namespace="CMSLYF.Models.Entity" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
         Index
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="LYF_all">
       <img src="../../Content/Image/lyf_siteMapPath.gif" />
        <asp:SiteMapPath ID="SiteMapPath1" runat="server"></asp:SiteMapPath>
        <fieldset id="content_fieldset" style="border:1px solid yellow">           
            <h2>SiteSetting_Index</h2>
            <table>
                <tr style="background-color:#ff6a00;">
                    <th>Name</th>
                    <th>Value</th>
                    <th>操作</th>
                </tr>
                <%foreach(SiteSettingsEntity sse in Model){ %>
                <tr>
                    <th><%=sse.Name %></th>
                    <th><%=sse.Value %></th>
                    <th><a href="javascript:FunShowSiteSetting(<%=sse.SiteSettingId %>)">修改</a>|</th>
                </tr>
                <tr style="background-color:yellow">
                    <th></th>
                    <th></th>
                    <th></th>
                </tr>
                <%} %>
            </table>
          <form action="/SiteSetting/Index" method="post">
            网站设置信息:<br />
            名称:<input type="text" id="Name" name="Name" /><br />
            值  :<input type="text" id="Value" name="Value" /><br />
            <input type="submit" id="ButtonSave" name="" value="保存修改" hidden="hidden" />
            <input type="button" id="ButtonAddSet" name="" value="添加" />
          </form>
     </fieldset>
    </div>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderStyle" runat="server">
        <script src="../../Scripts/jquery-1.8.2.js"></script>
        <script type="text/javascript">
            function FunShowSiteSetting(id) {
                $.post("/SiteSetting/SelectSiteSettingById/" + id, function (data) {
                    $("#Name").val(data.Name);
                    $("#Value").val(data.Value);
                    $("#ButtonAddSet").hide();
                    $("#ButtonSave").show();
                });
                
            }
        </script>
    </asp:Content>
  • 相关阅读:
    第十章第二节 阿基米德原理
    python-文件读写操作
    pyqt5-控件的显示与隐藏
    pyqt5-控件是否可用
    使用Visual Studio 2015开发Android 程序
    字节序(byte order)和位序(bit order)
    庖丁解牛-----Live555源码彻底解密(根据MediaServer讲解Rtsp的建立过程)
    H264系列(9):H264中的时间戳(DTS和PTS)
    EMIPLIB简介
    minidump-DMP文件的生成和使用
  • 原文地址:https://www.cnblogs.com/blogLYF/p/5653971.html
Copyright © 2011-2022 走看看