【调度系统】广东民航医疗快线调度系统源代码
wanglizhong
2025-06-16 ae5b0a8c63979351028215b8fe8cdf4b0766c272
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* sets the class of the tr containing the checked checkbox to selected */
function set_tr_class(element, selected) {
    if (selected) {
        element.attr("class", "selected " + element.attr("class"))
    } else {
        var css = element.attr("class");
        var position = css.indexOf('selected');
 
        element.attr("class", css.substring(position + 9));
    }
}
 
$(document).ready(function () {
    /* checks all the checkboxes within a table */
    $("table input[class=checkall]").live("click", function (event) {
        var checked = $(this).attr("checked");
 
        $("table input[type=checkbox]").each(function () {
            this.checked = checked;
 
            if (checked) {
                set_tr_class($(this).parent().parent(), true);
            } else {
                set_tr_class($(this).parent().parent(), false);
            }
        });
    });
 
    /* sets the class of the table tr when a checkbox within the table is checked */
    $("table input[type=checkbox]").live("click", function (event) {
        if ($(this).attr("checked")) {
            set_tr_class($(this).parent().parent(), true);
        } else {
            set_tr_class($(this).parent().parent(), false);
        }
    });
});