• 表单与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>
  • 相关阅读:
    爱情七十八课,闲了就“犯贱”
    阿里巴巴中文站的CSS设计规则(转)
    爱情八十一课,可预测的分手
    [性格][管理]《九型人格2》 唐·理查德·里索(美)、拉斯·赫德森(美)
    爱情八十二课,爱情三国杀
    爱情七十九课,不爱权力大
    [心理学]《爱情心灵安全岛》 四四
    一些你不知道的囧知识,保证让你崩溃
    爱情七十四课,我们的意义
    爱情七十六课,门当户对
  • 原文地址:https://www.cnblogs.com/blogLYF/p/5653971.html
Copyright © 2020-2023  润新知