zoukankan      html  css  js  c++  java
  • tabel 选中行变色和取当前选中行值等问题

      先把代码贴出来

        

      $("#tableId tbody tr").mousedown(function () {
            $('#tableId  tr').each(function () {
                $(this).css("background-color", "");
            });
            $(this).css("background-color", "#98D8F5");
        });

        //详细页面按钮
        $("#Detail_Button").click(function () {
            var baseinfoMngno = "";
            $('#tableId tr').each(function () {
                if ($(this).css("background-color") != $("th").css("background-color")) {
                    baseinfoMngno = $(this).find("td").eq(0).text();
                    return false;
                }
            });
            if (baseinfoMngno == null || baseinfoMngno == undefined || baseinfoMngno == "") {
                alert("请选择一样数据");
            } else {
                window.location.href = "ContentsMngTblOperate.aspx?type='detail'&baseinfoMngno=" + baseinfoMngno;
            }
        })

      <table id="tableId" style="100%;text-align:center;overflow-x: auto; overflow-y: auto; ">
                        <thead>
                            <tr>
                                <th style="display:none">コンテンツ情報管理番号</th>
                                <th style="15%;">有斐閣コード/雑誌特定コード</th>
                                <th style="30%;">タイトル</th>
                                <th style="10%;">シリーズ名</th>
                                <th style="30%;">編著者名</th>
                                <th style="5%;">法個オ</th>
                                <th style="20%;">更新日</th>
                            </tr>
                        </thead>
                        <tbody>
                            <asp:Repeater ID="ContentsMngTbl_Repeater" runat="server">
                                <ItemTemplate>
                                <tr>
                                    <td style="display:none;"><%#Eval("baseinfoMngno").ToString()%></td>
                                    <td><%#Eval("yuhikakuCD").ToString()%>/<%#Eval("magazineCD").ToString()%></td>
                                    <td><%#Eval("title").ToString()%></td>
                                    <td><%#Eval("seriesName").ToString()%></td>
                                    <td><%#Eval("authName").ToString()%></td>
                                    <td>
                                        <%#Eval("permmitPersonal").ToString() == "0"?"○":"×"%>|
                                        <%#Eval("permmitCompany").ToString() == "0"?"○":"×"%>|
                                        <%#Eval("permmitOndemand").ToString() == "0"?"○":"×"%>
                                    </td>
                                    <td><%#Eval("update_date").ToString()%></td>
                                </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                        </tbody>
                    </table>

      上面这段代码应该很容易理解吧

  • 相关阅读:
    如何使标签a处于不可用状态
    document.referrer的使用和window.opener 跟 window.parent 的区别
    纯CSS让overflow:auto页面滚动条出现时不跳动
    闭包的使用实例
    VMware workstation使用小技巧
    个人命令简记
    中国剩余定理
    UVA 10603 倒水问题
    Haybale Stacking(差分数组 + 求中位数的一些方法 + nth_element)
    POJ 1511 Invitation Cards (最短路的两种方法spfa, Dij)
  • 原文地址:https://www.cnblogs.com/hongcong/p/5690753.html
Copyright © 2011-2022 走看看