>웹 프론트엔드 >JS 튜토리얼 >경고 method_javascript 기술을 재정의하는 javascript의 예제 코드

경고 method_javascript 기술을 재정의하는 javascript의 예제 코드

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB원래의
2016-05-16 17:39:03945검색

코드 복사 코드는 다음과 같습니다.





    重写alert
   
   
   
'+''+'');
            if($.alerts.dialogClass)$("#popup_container").addClass($.alerts.dialogClass);
            var pos=($.browser.msie&&parseInt($.browser.version)            $("#popup_container").css({
                position:pos,zIndex:99999,padding:0,margin:0
            });
            $("#popup_title").text(title);
            $("#popup_content").addClass(type);
            $("#popup_message").text(msg);
            $("#popup_message").html($("#popup_message").text().replace(/\n/g,'
'));
            $("#popup_container").css({
                minWidth:$("#popup_container").outerWidth(),maxWidth:$("#popup_container").outerWidth()
            });
            $.alerts._reposition();
            $.alerts._maintainPosition(true);
            switch(type){
                case'alert':$("#popup_message").after('');
                $("#popup_ok").click(function(){
                    $.alerts._hide();
                    callback(true)
                });
                $("#popup_ok").focus().keypress(function(e){
                    if(e.keyCode==13||e.keyCode==27)$("#popup_ok").trigger('click')
                });
                break
            };
            if($.alerts.draggable){
                try{
                    $("#popup_container").draggable({
                        handle:$("#popup_title")
                    });
                    $("#popup_title").css({
                        cursor:'move'
                    })
                }
                catch(e){}
            }
        }
        ,_hide:function(){
            $("#popup_container").remove();
            $.alerts._overlay('hide');
            $.alerts._maintainPosition(false)
        }
        ,_overlay:function(status){
            switch(status){
                case'show':$.alerts._overlay('hide');
                $("BODY").append('');
                $("#popup_overlay").css({
                   위치:'절대',zIndex:99998,상단:'0px',왼쪽:'0px',너비:'100%', 높이:$(document).height(),배경:$.alerts.overlayColor,opacity:$.alerts.overlayOpacity
              });
               break;
               케이스'hide':$("#popup_ 오버레이 ").remove();
               break
            }
        }
        ,_reposition:function(){
           var top=(($(window).height() 2 ) - ( $("#popup_container").outerHeight() /2)) $.alerts.verticalOffset;
            var left=(($(window).width()/ 2) - ($("#popup_container"). externalWidth() /2)) $.alerts.horizontalOffset;
            if(top            if(left            if($.browser.msie&&parseInt( $.browser.version)            $("#popup_container").css({
               상단: 상단 'px', 왼쪽:왼쪽 'px'
            });
            $("#popup_overlay").height($(document).height())
        }
        ,_maintainPosition:function(status){
            만약 ($.alerts.repositionOnResize){
               스위치(상태){
                   케이스 true:$(window).bind('resize',function(){
                      $.alerts._re 위치()
});
                   break;
                   case false:$(window).unbind('resize');
                 break
              }
            }
        }
    };
jAlert=기능(메시지,제목,콜백){
        $.alerts.alert(메시지,제목,콜백)
    }

    $(function(){alert("안녕하세요!")})
   
   




성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.