/**
* 自定义静态消息提示框
* @param msg 提示消息
*/
var AlertMsg = function () {
var timeout001 = null;
/**
* 静态提示框
* @param msg 提示消息
* @param time 提示显示存在时间(毫秒),默认2000毫秒
*/
var showMsg = function showMsg(msg, time) {css
msg = msg + "";
html
if (msg == undefined || msg == '') { return; } if (time == undefined || time == '' || time == 0) { time = 2000; } qudiao234(); var arr = []; arr.push('<div id="zdydivmsg234" style="position: fixed; bottom: 20%;z-index: 20000;max-width:80%; ">'); arr.push('<div style="text-align:center;word-wrap:break-word;word-break:break-all;border-radius:6px;font-size: 14px; font-family:' + '\'宋体\'' + ';background: #3F3F3F;padding:10px 20px; color: white;">'); arr.push(msg); arr.push('</div></div>'); var html = arr.join(''); $("body").append(html); var widthWindow = $(window).width(); var spaceWidth = widthWindow - $('#zdydivmsg234').outerWidth(); var marginleft = spaceWidth / 2; $("#zdydivmsg234").css("margin-left", marginleft); timeout001 = setTimeout(qudiao234, time);//指定几秒后去掉html } /** * 去掉消息框 */ function qudiao234() { clearTimeout(timeout001); timeout001 = null; $("#zdydivmsg234").remove(); } return showMsg; }();