欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

js弹出窗的用法

程序员文章站 2024-03-21 12:10:16
...

这几天在做排班系统,做好后的系统界面如下:
js弹出窗的用法
用户需求如下:
需要在轮休表中进行班次调整,请假,等.故利用js弹窗实现如下效果.
js弹出窗的用法
实现代码如下:
js弹出窗的用法

 $('#user_table tbody tr').each(function () {
    var name = $(this).children('td:eq(5)').html();
    $(this).children('td:eq(2)').attr('onclick', 'paiban_click(this)');
    for (var i = 6; i < $(this).children('td').length; i++) {
        $(this).children('td').eq(i).attr('onclick', 'paiban2_click(this)');
    }
})
function paiban_click(e) {
    var this_id = $(e).attr('id');
    var name = $(e).parent('tr').children('td:eq(5)').html();
    $('#name').html(name)
    var _seft = e;
    var A_top = $(_seft).offset().top + 3 * $(_seft).outerHeight(true) / 4;  //  1
    var A_left = $(_seft).offset().left + 3 * $(_seft).outerWidth(true) / 4;
    $('#selectType').show().css({ "position": "absolute", "top": A_top + "px", "left": A_left + "px" });
    $(document).click(function (event) {
        if (event.target.id != this_id) {
            $('#selectType').hide();
        } else {
            $('#selectType').show();
        }
    });
}