    function savelevelpermission(url) {
                    $(".editBtn").click(function() {
            var btn = this;
            var status = $(btn).attr('status');
            var setStatus = function(obj, status) {
                var statusO = {1: {name: '修改', color: 'black'},
                    2: {name: '保存', color: 'green'}, 3: {name: '正在保存', color: 'black'}}

                $(obj).attr('status', status);
                $(obj).css('color', statusO[status].color)
                $(obj).html(statusO[status].name);
            }
            var scores = $(btn).parents('tr').find('.setPermission');
            if (status == 1) {
                scores.each(function(i, n) {
                    //alert($(n).html())
                    var v = $(n).html();
                    var strCheck = '';
                    if (v != '') {
                        strCheck = 'checked';
                    }
                    var x = 'onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,\'\');}).call(this)" onblur="this.v();" ';
                    $(n).html("<input type='checkbox' name='status'" + strCheck + "/>")
                })
                setStatus(this, 2);
            }

            if (status == 2) {
                var data = [];
                scores.each(function(i, n) {
                    //alert($(n).html())
                    var v = $(n).find('input').attr('checked');
                    var status;
                    if (v == 'checked') {
                        status = 1;
                    } else {
                        status = 0;
                    }
                    var temp = {};
                    temp.status = status;
                    temp.level_id = $(n).next().val();
                    temp.way_id = $(btn).prev().val();
                    data.push(temp);
                    //$(n).html(v)
                })
                setStatus(btn, 3);
               // var url = './exp_setting_ajax.php';
                    
                $.post(url, {action: 'save', data: data}, function(re) {
                    if (re.result == 1) {
                        scores.each(function(i, n) {
                            //alert($(n).html())
                            var v = $(n).find('input').attr('checked');
                            if (v == 'checked') {
                                 status = '√';
                             } else {
                                 status = '';
                             }
                            if (v < 0) {
                                $(n).css('color', 'red');
                            } else {
                                $(n).css('color', 'black');
                            }
                            $(n).html(status);
                        })
                        setStatus(btn, 1);
                    } else {
                        alert("保存失败！")
                    }
                }, 'json')

            }
            return false;
        })
    }



