博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[转]自动消失提示框
阅读量:7065 次
发布时间:2019-06-28

本文共 3478 字,大约阅读时间需要 11 分钟。

function alert(str, caption) {    this.disappear = function () {        $("#bgdiv").remove();        $("#msgdiv").remove();        $("#msgtitle").remove();        msgobj = null;        msgdiv = null;    };    disappear();    this.m_text = str;    this.m_caption = caption;    this.m_width = 200;    this.m_height = 100;    this.m_wait = 1000;    this.m_fade = 500;    this.m_bordercolor = "#336699";    this.m_titlecolor = "#99ccff";    var msgw, msgh, bordercolor;    msgw = m_width; //提示窗口的宽度    msgh = m_height; //提示窗口的高度    titleheight = 25 //提示窗口标题高度    bordercolor = m_bordercolor; //提示窗口的边框颜色    titlecolor = m_titlecolor; //提示窗口的标题颜色    var swidth, sheight;    swidth = document.body.offsetWidth;    sheight = document.body.offsetHeight;    if (sheight < screen.height) {        sheight = screen.height;    }    // //此处可以添加一个背景,防止多次点击保存按钮    // if(bgobj==undefined){
// var bgobj=document.createElement("div"); // } // bgobj.setAttribute('id','bgdiv'); // bgobj.style.position="absolute"; // bgobj.style.top="0"; // bgobj.style.background="#777"; // bgobj.style.filter="progid:dximagetransform.microsoft.alpha(style=3,opacity=25,finishopacity=75"; // bgobj.style.opacity="0.6"; // bgobj.style.left="0"; // bgobj.style.width=swidth + "px"; // bgobj.style.height=sheight + "px"; // bgobj.style.zindex = "10000"; // document.body.appendChild(bgobj); if (msgobj == null) { var msgobj = document.createElement("div"); } msgobj.setAttribute("id", "msgdiv"); msgobj.setAttribute("align", "center"); msgobj.style.background = "white"; msgobj.style.border = "1px solid " + bordercolor; msgobj.style.position = "absolute"; msgobj.style.left = "50%"; msgobj.style.top = "50%"; msgobj.style.font = "12px/1.6em verdana, geneva, arial, helvetica, sans-serif"; msgobj.style.marginLeft = "-115px"; msgobj.style.marginTop = -115 + document.documentElement.scrollTop + "px"; msgobj.style.width = msgw + "px"; msgobj.style.height = msgh + "px"; msgobj.style.textAlign = "center"; msgobj.style.lineHeight = (msgh - titleheight) + "px"; msgobj.style.zIndex = "10001"; if (title == null) { var title = document.createElement("h4"); } title.setAttribute("id", "msgtitle"); title.setAttribute("align", "left"); title.style.margin = "0"; title.style.padding = "3px"; title.style.background = bordercolor; title.style.filter = "progid:dximagetransform.microsoft.alpha(startx=20, starty=20, finishx=100, finishy=100,style=1,opacity=75,finishopacity=100);"; title.style.opacity = "0.75"; title.style.border = "1px solid " + bordercolor; title.style.height = "18px"; title.style.font = "12px verdana, geneva, arial, helvetica, sans-serif"; title.style.color = "white"; title.style.cursor = "pointer"; title.innerHTML = "消息提示"; title.onclick = function () { disappear(); } document.body.appendChild(msgobj); document.getElementById("msgdiv").appendChild(title); var txt = document.createElement("p"); txt.style.margin = "1em 0" txt.setAttribute("id", "msgtxt"); txt.innerHTML = str; document.getElementById("msgdiv").appendChild(txt); this.fadeout = function () { $("#bgdiv").fadeOut(1000); $("#msgdiv").fadeOut(1000); $("#msgtitle").fadeOut(1000, function () { disappear() }); } setTimeout("fadeout()", 500);};

 

转载于:https://www.cnblogs.com/yeminglong/archive/2013/01/15/2860616.html

你可能感兴趣的文章
理解管理信息系统
查看>>
UVA 11991 - Easy Problem from Rujia Liu?
查看>>
CF1101E Polycarp's New Job
查看>>
3d角色模型 制作 全过程 。3d max 。3d role model making process.3d Max
查看>>
开学第一周
查看>>
Pandas学习笔记,groupby的一些用法
查看>>
浅谈C#中的延迟加载“.NET研究”(1)——善用委托
查看>>
VS“.NET研究”2010测试功能之旅:编码的UI测试(1)
查看>>
接口库设计总结
查看>>
redis查看数据
查看>>
DFS ( 深度优先/回溯算法 ) 一
查看>>
Enum一点使用总结
查看>>
eclipse +VISUALSVN SERVER 创建版本控制器,防止误操作(可视化操作,简单方便,不需要修改配置文件)...
查看>>
一致性hash
查看>>
C++函数的重载
查看>>
WPF自定义控件与样式(9)-树控件TreeView与菜单Menu-ContextMenu
查看>>
苹果应用的上线步骤
查看>>
初识scoket
查看>>
Stardew Valley(星露谷物语)Mod开发之路 1环境配置
查看>>
2012 借教室
查看>>