会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
海浪
博客园
首页
新随笔
订阅
管理
模仿163邮箱里的错误提示框
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title> New Document </title> <meta name="Generator" content="EditPlus"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> </head> <body> <script language="javascript"> var ShowMsg = { flag:false, shield:null, alertFram:null, opacity:0, interval:null, Show:function(strTxt,boolCustom){ boolCustom=boolCustom?true:false; if (ShowMsg.flag) { strTxt=strTxt.toString().replace(/\\/gi,"\\\\"); strTxt=strTxt.replace(/"/gi,"\\\""); strTxt=strTxt.replace(/'/gi,"\\\'"); strTxt=strTxt.replace(/\n/,"\\n"); setTimeout("ShowMsg.Show(\""+strTxt+"\","+boolCustom+");",500); return; } else { ShowMsg.flag=true; } ShowMsg.shield = document.createElement("DIV"); ShowMsg.shield.style.position = "absolute"; ShowMsg.shield.style.left = "0px"; ShowMsg.shield.style.top = "0px"; ShowMsg.shield.style.width = "100%"; ShowMsg.shield.style.height = document.body.clientHeight+"px"; ShowMsg.shield.style.background = "#333"; ShowMsg.shield.style.textAlign = "center"; ShowMsg.shield.style.zIndex = "1"; ShowMsg.shield.style.filter = "alpha(opacity=0)"; ShowMsg.shield.style.opacity=0; ShowMsg.alertFram = document.createElement("DIV"); ShowMsg.alertFram.style.position = "absolute"; ShowMsg.alertFram.style.left = "50%"; ShowMsg.alertFram.style.top = "50%"; ShowMsg.alertFram.style.marginLeft = "-225px"; ShowMsg.alertFram.style.marginTop = "-75px"; ShowMsg.alertFram.style.width = "450px"; ShowMsg.alertFram.style.height = "150px"; ShowMsg.alertFram.style.textAlign = "center"; ShowMsg.alertFram.style.zIndex = "2"; if (boolCustom) { strHtml=strTxt; } else { strHtml = "<ul style=\"list-style:none;margin:0px;padding:0px;width:100%\">\n"; strHtml += " <li style=\"color:#FFF;background:#DD828D;text-align:left;padding-left:20px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;\">[系统提示]</li>\n"; strHtml += " <li style=\"background:#fff;text-align:center;font-weight:bold;height:120px;line-height:120px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;\">"+strTxt+"</li>\n"; strHtml += " <li style=\"background:#FDEEF4;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #F9CADE;\"><input type=\"button\" value=\"确 定\" onclick=\"ShowMsg.doOk()\" /></li>\n"; strHtml += "</ul>\n"; } ShowMsg.alertFram.innerHTML = strHtml; document.body.appendChild(ShowMsg.alertFram); document.body.appendChild(ShowMsg.shield); ShowMsg.opacity = 0; ShowMsg.interval = setInterval("ShowMsg.doAlpha()",20); }, doAlpha:function(){ if (!ShowMsg.flag) { return; } if (ShowMsg.opacity>30) { clearInterval(ShowMsg.interval); return; } ShowMsg.shield.style.filter = "alpha(opacity="+ShowMsg.opacity+");"; ShowMsg.shield.style.opacity=ShowMsg.opacity/100; ShowMsg.opacity+=3; }, doOk:function(){ if (!ShowMsg.flag) { return; } ShowMsg.alertFram.parentNode.removeChild(ShowMsg.alertFram); ShowMsg.shield.parentNode.removeChild(ShowMsg.shield); ShowMsg.alertFram=null; ShowMsg.shield=null; ShowMsg.opacity=0; ShowMsg.interval=null; ShowMsg.flag=false; } } </script> <input type="button" value="测试" onclick="ShowMsg.Show('测试提示信息框');"> </body> </html>
提示:您可以先修改部分代码再运行
posted @
2007-03-27 15:54
海浪~~
阅读(
301
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告