处理中...
';
//呈现loading效果
//document.write(_loadinghtml);
var stylestr = 'position:fixed;left:0px;width:100%;height:100%;top:0px;background:#000000;opacity:0.9;filter:alpha(opacity=90);z-index:10000;';
childdiv.id = "loadingdiv";
childdiv.setattribute("id","loadingdiv");
childdiv.style.csstext = stylestr;
childdiv.innerhtml = _loadinghtml;
//document.body.insertbefore(childdiv, document.body.firstchild);
document.body.appendchild(childdiv);
}
function clearprocess(){
var childdiv = document.getelementbyid("loadingdiv");
if(childdiv)
document.body.removechild(childdiv);
}
function alerttoast(msg){
var childdiv = document.createelement("div");
childdiv.setattribute("class","toast-wrap");
childdiv.innerhtml="';
//必须先将_html添加到body,再设置css样式
$("body").append(_html); generatecss();
switch( type ) {
case 'alert':
$("#mb_btn_ok").click( function() {
$.alerts._hide();
callback(true);
});
$("#mb_btn_ok").focus().keypress( function(e) {
if( e.keycode == 13 || e.keycode == 27 ) $("#mb_btn_ok").trigger('click');
});
break;
case 'confirm':
$("#mb_btn_ok").click( function() {
$.alerts._hide();
if( callback ) callback(true);
});
$("#mb_btn_no").click( function() {
$.alerts._hide();
if( callback ) callback(false);
});
$("#mb_btn_no").focus();
$("#mb_btn_ok, #mb_btn_no").keypress( function(e) {
if( e.keycode == 13 ) $("#mb_btn_ok").trigger('click');
if( e.keycode == 27 ) $("#mb_btn_no").trigger('click');
});
break;
}
},
_hide: function() {
$("#mb_box,#mb_con").remove();
}
}
// shortuct functions
myalert = function(title, message, callback) {
$.alerts.alert(title, message, callback);
}
myconfirm = function(title, message, callback) {
$.alerts.confirm(title, message, callback);
};
//生成css
var generatecss = function () {
$("#mb_box").css({ width: '100%', height: '100%', zindex: '99999', position: 'fixed',
filter: 'alpha(opacity=60)', backgroundcolor: 'black', top: '0', left: '0', opacity: '0.6'
});
$("#mb_con").css({ zindex: '999999', width: '350px',height:'200px', position: 'fixed',
backgroundcolor: 'white',
});
$("#mb_tit").css({ display: 'block', fontsize: '14px', color: '#444', padding: '10px 15px',
backgroundcolor: '#fff', borderradius: '15px 15px 0 0',
fontweight: 'bold'
});
$("#mb_msg").css({ padding: '20px', lineheight: '40px', textalign:'center',
fontsize: '18px' ,color:'#4c4c4c'
});
$("#mb_ico").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").css({ margin: '15px 0px 10px 0', textalign: 'center' });
$("#mb_btn_ok,#mb_btn_no").css({ width: '80px', height: '30px', color: 'white', border: 'none', borderradius:'4px'});
$("#mb_btn_ok").css({ backgroundcolor: '#41a259' });
$("#mb_btn_no").css({ backgroundcolor: 'gray', marginright: '40px' });
//右上角关闭按钮hover样式
$("#mb_ico").hover(function () {
$(this).css({ backgroundcolor: 'red', color: 'white' });
}, function () {
$(this).css({ backgroundcolor: '#ddd', color: 'black' });
});
var _widht = document.documentelement.clientwidth; //屏幕宽
var _height = document.documentelement.clientheight; //屏幕高
var boxwidth = $("#mb_con").width();
var boxheight = $("#mb_con").height();
//alert(_height);
//让提示框居中
$("#mb_con").css({ top: (boxheight) / 2 + "px", left: (_widht - boxwidth) / 2 + "px" });
}
})(jquery);