Lake Worke R

myWork.

need skills. i'm worker.

Name:
Location: 板橋, 台北, Taiwan

free is the end. 單車 單眼 電影 電玩 音樂 美食 旅行 咖啡 回憶 樂觀 悲觀 自閉 自卑 矛盾 作做 虛偽 過敏 失眠 人生 台灣 台北 板橋 文山 苗栗 竹南 頭份 雲林 斗六 君毅 忠信 聯大 雲科 FRIENDS

Monday, December 23, 2013

某元件 change, 取得 HiddenField 值並更新到 TextBox


    // 初始便不顯示
    var gv_rows = document.getElementById('<%= Gv_doc_send_no.ClientID%>').rows;
    if (gv_rows[0].innerText != "無資料") {
        for (i = 0; i < gv_rows.length; i++) {
            gv_rows[i].cells[2].style.display = 'none';
        }
    };

    // 無 UpdatePanel 會報錯
    //function backTop() {
    //    //// 讓捲軸移動到 0 的位置
    //    $(document).ready(function () {
    //        //    //alert($('#ctl00_lbl_UID').html());
    //        $('#ctl00_lbl_UID').focus();
    //    });
    //    //var doc = document.documentElement || document;
    //    //doc.scrollTop = 0;

    //    //return false;
    //};

    $(document).ready(function () {
        var obj1 = $(".jstb1");

        $(obj1).change(function () {
            var oo = document.getElementById('<%= TextBox3.ClientID%>');
            var targetValue = document.getElementById('<%= hf_todt.ClientID%>').value;
            var somedate = new Date(targetValue.substring(0, 4), targetValue.substring(4, 6) - 1, targetValue.substring(7, 8));
            somedate.setMonth(somedate.getMonth() + 2);
            oo.innerText = somedate.format("yyyy/MM/dd");
        });

        var obj2 = $(".jstb2");

        $(obj2).change(function () {
            var adate = document.getElementById('<%= Txt_adate.ClientID%>').value;
            var oo = document.getElementById('<%= TextBox3.ClientID%>');
            var targetValue = document.getElementById('<%= hf_todt.ClientID%>').value;
            var somedate = new Date(targetValue.substring(0, 4), targetValue.substring(4, 6) - 1, targetValue.substring(7, 8));
            somedate.setMonth(somedate.getMonth() + 2);
            if (adate != "") {
                alert(somedate.format("yyyy/MM/dd"));
                oo.innerText = somedate.format("yyyy/MM/dd");
            }
        });

    });

第一段: 預設不顯示 gridview 的某 row, (但可取得值).

第二段: 回到頂端(如說明, 在 UpdatePanel 沒有的情況下會報錯.

第三, 四段: Client 端取 HiddenField 設定入某元件.

Labels: ,

0 Comments:

Post a Comment

<< Home