• 提示信息 alert


    js代码

    function alertbox(option) {
    
        var thisel = this;
        thisel.mergeJsonObject = function (jsonbject1, jsonbject2) {
            var resultJsonObject = {};
            var attr;
            for (attr in jsonbject1) {
                resultJsonObject[attr] = jsonbject1[attr];
            }
            for (attr in jsonbject2) {
                resultJsonObject[attr] = jsonbject2[attr];
            }
    
            return resultJsonObject;
        };
        thisel.o = {
            successMsg: '操作成功',
            errMsg: '操作失败',
            autoClose: '1' //是否自动关闭
            //resize: {  320, height: 240, quality: 90 }
        };
        //合并配置
        thisel.o = thisel.mergeJsonObject(thisel.o, option);
    
        thisel.createHtml = function () {
            var htmlbox = $("body");
            htmlbox.append("<div class="y-cue" >" + "</div>");
        };
    
        function close() {
            //alert('dd');
            var htmlbox = $("body");
            var box = htmlbox.find(".y-cue");
            box.hide();
        }
    
        thisel.showsuccess = function () {
            var htmlbox = $("body");
            var box = htmlbox.find(".y-cue");
            box.html(thisel.o.successMsg);
            if (thisel.o.autoClose == '0') {
                box.append("<div><a href="javascript:void(0);" id="aalertClose">关闭</a></div>");
                $("#aalertClose").bind("click", function () {
                    close();
                });
                box.show();
            } else {
                box.fadeIn("fast");
                setTimeout(function () {
                    box.fadeOut("fast");
                }, 500);
            }
        };
    
        thisel.showerr = function () {
            var htmlbox = $("body");
            var box = htmlbox.find(".y-cue");
            box.html(thisel.o.errMsg);
            box.fadeIn("fast");
            setTimeout(function () {
                box.fadeOut("fast");
            }, 500);
        };
        thisel.warnerr = function (warnmsg) {
            var htmlbox = $("body");
            var box = htmlbox.find(".y-cue");
            box.html(warnmsg);
            box.fadeIn("fast");
            setTimeout(function () {
                box.fadeOut("fast");
            }, 1000);
        };
    
        thisel.hide = function () {
            setTimeout(function () {
                var htmlbox = $("body");
                var box = htmlbox.find(".y-cue");
                box.fadeOut("fast");
            }, 500);
        };
    
        thisel.showandredirct = function (url) {
            var htmlbox = $("body");
            var box = htmlbox.find(".y-cue");
            box.html(thisel.o.successMsg);
            box.fadeIn("fast");
            setTimeout(function () {
                box.fadeOut("fast");
                if (url) {
                    window.location = url;
                } else {
                    window.location = window.location;
                }
            }, 1000);
        };
    
    
        //初始化上传组建
        thisel.create = function () {
            thisel.createHtml();
        };
    
    
    }

    调用时

       var proup = null;
            $(function () {
                proup = new alertbox();
                proup.create();
            }); /// <summary>添加操作</summary>
  • 相关阅读:
    LeetCode Arithmetic Slices
    LeetCode Number of Longest Increasing Subsequence
    LeetCode Longest Increasing Subsequence
    shrio注解的方式进行权限控制
    30分钟学会如何使用Shiro(转自:http://www.cnblogs.com/learnhow/p/5694876.html)
    eclipse逆向生成实体类
    redis2.3.7安装时出现undefined reference to `clock_gettime'
    使用Nginx+Lua(OpenResty)开发高性能Web应用
    shrio初体验(2)Realm
    shrio初体验(1)
  • 原文地址:https://www.cnblogs.com/llxy/p/4205806.html
Copyright © 2020-2023  润新知