$(document).ready(function () {

            SelectRow();
     });

    function SelectRow() {
        $("#allchk").unbind('click');
        $("#allchk").click(function () {
            var allbox = $(this).attr("checked");
            if (allbox == true) {
                $('table#rptbl tr td input:checkbox').each(function () {
                    $(this).attr("checked", "checked");
                });
            } else {
                $('table#rptbl tr td input:checkbox').each(function () {
                    $(this).attr("checked", "");
                });
            }
        });

    var rows = $("table#rptbl tr");
    if (rows && rows.length > 0) {
        $(rows).each(function (idx) {
            if (idx > 0) {
                var startIdx = 1;
                var endIdx = rows[idx].childNodes.length;

                for (i = startIdx; i <= endIdx; i++) {
                    //$(rows[idx].childNodes[i]).click(function () {
                    $(rows[idx]).find('td').eq(i).unbind('click');
                    $(rows[idx]).find('td').eq(i).click(function () {
                        var ID = $(rows[idx]).find('td').eq(0).children('input[type="checkbox"]').val();          //GUID
                        alert("checkbox value : " + ID);
                        //ID 값을 넘겨서 ViewPage를 호출한다.
                    });
                }


                $(this).mouseover(function () {
                   
                    //$(rows[idx]).addClass('mouseovercolor').attr('style', 'cursor:pointer;cursor: hand;'); class로 주려면
                    $(rows[idx]).attr('style', 'cursor:pointer;cursor: hand;background-color:#f8f8f8;');

                });
                $(this).mouseout(function () {
                    $(rows[idx]).css('background-color', '').attr('style', '');
                });
            }


        });
        }
}

function fn_Delete() {
    var checked = $("table#rptbl tr input:checkbox:checked");
    $("#txtselectbox").val("");
    if (checked && checked.length > 0) {
            checked.each(function (index, fieldname) {
                if (fieldname.id == "") {
                    $("#txtselectbox").val($("#txtselectbox").val() + $(this).val() + ",");
                }
            });
    } else {
        alert('선택된게 없잖어!!!!');
        return false;
    }
}

'jquery' 카테고리의 다른 글

jQuery 속성(Attrbute)으로 셀렉터 하기...  (1) 2010.10.28
ImageNavi  (3) 2010.09.10
dynamic row  (1) 2010.09.09
select option의 첫번째 및 선택된 값 가져오기  (2) 2010.09.09
jquery 접근방식  (1) 2010.09.09
Posted by 정광원
,