(function () { $.MsgBox = { Alert: function (title, msg,type,sys) { GenerateHtml("alert",sys, title, msg,type); btnOk(); //alert只是弹出消息,因此没必要用到回调函数callback btnNo(); }, AlertOk: function (title,msg,callback,type, sys) { GenerateHtml("alertOk",sys, title, msg,type); btnOk(callback); btnNo(callback); } }; //生成Html var GenerateHtml = function (type,sys, title, msg,types) { var _html = ""; _html += '
提示信息'; if(sys==0){ sys="进港报告"; }else if(sys==1){ sys="出港报告"; }else if(sys==2){ sys="进港日报"; }else if(sys==3){ sys="出港日报"; }else if(sys==4){ sys="进港报告变更"; }else if(sys==5){ sys="出港报告变更"; }else if(sys==6){ sys="进港日报变更"; }else if(sys==7){ sys="出港日报变更"; } if(types=='error'){ _html += 'x
船舶'+sys+'提交失败!
错误原因:'+msg+'
'; }else if(types=='right'){ _html += 'x
船舶'+sys+'提交成功!
'+msg+'
'; } else{ _html += 'x
' + msg + '
'; } if (type == "alert") { _html += ''; } if (type == "alertOk") { _html += ''; } _html += '
'; //必须先将_html添加到body,再设置Css样式 $("body",parent.document).append(_html); GenerateCss(); }; //生成Css var GenerateCss = function () { $("#mb_box",parent.document).css({ width: '100%', height: '100%', zIndex: '99999', position: 'fixed', filter: 'Alpha(opacity=60)', backgroundColor: 'black', top: '0', left: '0', opacity: '0.6' }); $("#mb_con",parent.document).css({ zIndex: '999999', width: '300px', position: 'fixed', backgroundColor: 'White', /*borderRadius: '15px'*/ }); $("#mb_tit",parent.document).css({ display: 'block', fontSize: '14px', color: '#444', padding: '10px 15px', backgroundColor: '#fff', /*borderRadius: '15px 15px 0 0',*/ borderBottom: '2px solid #009BFE', fontWeight: 'bold' }); $("#mb_msg",parent.document).css({ padding: '20px', lineHeight: '20px', /*borderBottom: '1px dashed #DDD',*/ fontSize: '13px' }); $(".mb_error",parent.document).css({ color:'red' }); $(".mb_right",parent.document).css({ color:'RGB(52,141,255)' }); $("#mb_reason",parent.document).css({ paddingLeft: '20px',paddingRight: '20px',paddingBottom:'20px', lineHeight: '20px', borderBottom: '1px dashed #DDD', fontSize: '13px' }); $("#mb_ico",parent.document).css({ display: 'block', position: 'absolute', right: '10px', top: '9px', border: '1px solid Gray', width: '18px', height: '18px', textAlign: 'center', lineHeight: '16px', cursor: 'pointer', borderRadius: '12px', fontFamily: '微软雅黑' }); $("#mb_btnbox",parent.document).css({ margin: '15px 0 10px 0', textAlign: 'center' }); $("#mb_btn_ok,#mb_btn_no",parent.document).css({ width: '150px', height: '30px', color: 'white', border: 'none' }); $("#mb_btn_ok",parent.document).css({ backgroundColor: '#168bbb',borderRadius:'5px'}); //右上角关闭按钮hover样式 $("#mb_ico",parent.document).hover(function () { $(this).css({ backgroundColor: 'Red', color: 'White' }); }, function () { $(this).css({ backgroundColor: '#FFF', color: 'black' }); }); var _widht = parent.document.documentElement.clientWidth; //屏幕宽 var _height = parent.document.documentElement.clientHeight; //屏幕高 /* var _widht = window.screen.width; //屏幕宽 var _height = window.screen.height; //屏幕高 */ var boxWidth = $("#mb_con",parent.document).width(); var boxHeight = $("#mb_con",parent.document).height(); //让提示框居中 $("#mb_con",parent.document).css({ top: (_height - boxHeight) / 2 + "px", left: (_widht - boxWidth) / 2 + "px" }); }; //确定按钮事件 var btnOk = function (callback) { $("#mb_btn_ok",parent.document).click(function () { $("#mb_box,#mb_con",parent.document).remove(); if (typeof (callback) == 'function') { callback(); } }); }; //取消按钮事件 var btnNo = function (callback) { $("#mb_btn_no,#mb_ico",top.window.document).click(function () { $("#mb_box,#mb_con",top.window.document).remove(); if (typeof (callback) == 'function') { callback(); } }); }; })(); (function () { $.MsgBox1 = { Alert: function (title, msg,type) { GenerateHtml("alert", title, msg,type); btnOk(); //alert只是弹出消息,因此没必要用到回调函数callback btnNo(); }, Alert1: function (title, msg,callback,type) { //增加回调 GenerateHtml("alert", title, msg,type); btnOk(callback); btnNo(callback); }, AlertOk: function (title, msg,callback,type) { GenerateHtml("alertOk", title, msg,type); btnOk(callback); btnNo(); }, Confirm: function (title, msg, callback,type) { GenerateHtml("confirm", title, msg,type); btnOk(callback); btnNo(); }, Confirm1: function (title, msg, callbackOK,callbackNO,type) {//有取消回调的comfirm GenerateHtml("confirm", title, msg,type); btnOk(callbackOK); btnNo(callbackNO); } }; //生成Html var GenerateHtml = function (type, title, msg,types) { var _html = ""; _html += '
提示信息'; if(types=='warn'){ _html += 'x
' + msg + '
'; }else if(types=='error'){ _html += 'x
' + msg + '
'; }else if(types=='right'){ _html += 'x
' + msg + '
'; } else{ _html += 'x
' + msg + '
'; } if (type == "alert") { _html += ''; } if (type == "alertOk") { _html += ''; } if (type == "confirm") { _html += ''; _html += ''; } if (type == "confirm1") { _html += ''; _html += ''; } _html += '
'; //必须先将_html添加到body,再设置Css样式 $("body",top.window.document).append(_html); GenerateCss(); }; //生成Css var GenerateCss = function () { $("#mb_box",top.window.document).css({ width: '100%', height: '100%', zIndex: '99999', position: 'fixed', filter: 'Alpha(opacity=60)', backgroundColor: 'black', top: '0', left: '0', opacity: '0.6' }); $("#mb_con",top.window.document).css({ zIndex: '999999', width: '400px', position: 'fixed', backgroundColor: 'White', /*borderRadius: '15px'*/ }); $("#mb_tit",top.window.document).css({ display: 'block', fontSize: '14px', color: '#444', padding: '10px 15px', backgroundColor: '#fff', /*borderRadius: '15px 15px 0 0',*/ borderBottom: '2px solid #009BFE', fontWeight: 'bold' }); $("#mb_msg",top.window.document).css({ padding: '20px', lineHeight: '20px', borderBottom: '1px dashed #DDD', fontSize: '13px' }); $("#mb_ico",top.window.document).css({ display: 'block', position: 'absolute', right: '10px', top: '9px', border: '1px solid Gray', width: '18px', height: '18px', textAlign: 'center', lineHeight: '16px', cursor: 'pointer', borderRadius: '12px', fontFamily: '微软雅黑' }); $("#mb_btnbox",top.window.document).css({ margin: '15px 0 10px 0', textAlign: 'center' }); $("#mb_btn_ok,#mb_btn_no",top.window.document).css({ width: '85px', height: '30px', color: 'white', border: 'none' }); $("#mb_btn_ok",top.window.document).css({ backgroundColor: '#168bbb' }); $("#mb_btn_no",top.window.document).css({ backgroundColor: 'gray', marginLeft: '20px' }); $("#mb_btn_ok1,#mb_btn_no",top.window.document).css({ width: '85px', height: '30px', color: 'white', border: 'none' }); $("#mb_btn_ok1",top.window.document).css({ backgroundColor: '#168bbb' }); //右上角关闭按钮hover样式 $("#mb_ico",top.window.document).hover(function () { $(this).css({ backgroundColor: 'Red', color: 'White' }); }, function () { $(this).css({ backgroundColor: '#FFF', color: 'black' }); }); /*var _widht = window.screen.width; //屏幕宽 var _height = window.screen.height; //屏幕高*/ var _widht = top.window.document.documentElement.clientWidth; //屏幕宽 var _height = top.window.document.documentElement.clientHeight; //屏幕高 var boxWidth = $("#mb_con",top.window.document).width(); var boxHeight = $("#mb_con",top.window.document).height(); //让提示框居中 $("#mb_con",top.window.document).css({ top: (_height - boxHeight) / 2 + "px", left: (_widht - boxWidth) / 2 + "px" }); }; //确定按钮事件 var btnOk = function (callback) { $("#mb_btn_ok",top.window.document).click(function () { $("#mb_box,#mb_con",top.window.document).remove(); if (typeof (callback) == 'function') { callback(); } }); $("#mb_btn_ok1",top.window.document).click(function () { if (typeof (callback) == 'function') { callback(); } /*$("#mb_box,#mb_con").remove();*/ }); }; //取消按钮事件 var btnNo = function (callback) { $("#mb_btn_no,#mb_ico",top.window.document).click(function () { $("#mb_box,#mb_con",top.window.document).remove(); if (typeof (callback) == 'function') { callback(); } }); }; })(); //--窗口遮罩-- function ajaxLoading() { $("
").css( { display : "block", width : "100%", height : "100%" }).appendTo("body"); $("
").html("正在处理, 请稍候...").appendTo("body").css( { display : "block", left : ($(document.body).outerWidth(true) - 139) / 2, top : ($(window).height() - 45) / 2 }); } // --窗口遮罩-- function ajaxLoading(text) { $("
").css( { display : "block", width : "100%", height : "100%" }).appendTo("body"); $("
").html(text).appendTo("body").css( { display : "block", left : ($(document.body).outerWidth(true) - 139) / 2, top : ($(window).height() - 45) / 2 }); } // --移掉窗口遮罩-- function ajaxLoadEnd() { $(".datagrid-mask").remove(); $(".datagrid-mask-msg").remove(); }