JS:checkbox 全選及傳值相關

來源:互聯網
上載者:User

標籤:jquery   checkbox   


判斷checkbox是否被選中、

if ($('#checkbox-id').attr('checked')) {// do something}if ($("#checkbox-id")get(0).checked) {// do something}if($('#checkbox-id').is(':checked')) {// do something}


前台傳值,後台接收值

<script language="javascript" type="text/javascript">        //開啟        function ViewCard(BelongsDept, Manufacturer) {            //alert("aaaa");            var url;            var name = 'Page';            var iWidth = 600; //快顯視窗的寬度;            var iHeight = 450; //快顯視窗的高度;            var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //獲得視窗的垂直位置;            var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //獲得視窗的水平位置;            url = "Page.aspx?參數1=" + 參數1+ "&參數2=" + 參數2;            w = window.open(url, name, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=yes,resizeable=no,location=no,status=no');            //開啟儀錶卡表單,置前            w.focus();        }    </script>


string str1 = Request["參數1"] ;string str2 = Request["參數2"] ;


JQuery控制全選,及子項

    <script language="javascript" type="text/javascript">        //CheckBox事件        $(function () {            //全選按鈕選擇,如果全選按鈕為選擇狀態,遍曆CHECKBOX,設定選擇狀態            $("#checkAll").click(function () {                var BoolSel = $(this).attr("checked");                $("input[type=checkbox][name=checkItem]").each(function (n, v) {                    v.checked = BoolSel;                });            });        });    </script>
<input id="checkAll" type="checkbox" />

這裡有個問題,遍曆時,若子項與後台有互動,則name值會改變成與該ID同值,導致遍曆失敗

</pre><p></p><p>清空Session</p><p>登出或退出登入,再或者 登陸前清空</p><p><pre class="csharp" name="code">            if (!IsPostBack)            {                Session.Clear();                Session.Abandon();            }

PS:本文僅為記錄交流,不做他用。

未經允許,不得轉載。




JS:checkbox 全選及傳值相關

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.