日期:2014-05-16 浏览次数:20359 次
/**
** 功能:弹出消息框类,背景渐变到半透明,还可以只弹出半透明层
** 作者:胡成洪
** 日期:2010-06-10
**/
function __messageBox()
{
var isIe=!!document.all;
var obj = this;
var backDiv = null;
var messageDiv = null;
window._msgZindex = window._msgZindex || 200000;
//弹出提示框
this.showMessageBox=function (wTitle,content,wWidth,type,confirmFun,cancelFun)
{
type = type||0;
obj.showBackgroundDiv();
if(typeof(content)=='string'){
messageDiv=document.createElement("div");
messageDiv.className="mesWindow";
var html = "<div class='mesWindowTop'><table width='100%' height='100%'><tr><td>"+wTitle+"</td><td style='width:1px;'><input type='button' class='close' value='关闭' /></td></tr></table></div><div class='mesWindowContent' >"+content+"</div>";
if(type>0){html+="<div class='mesWindowBottom'><a href='javascript:void(0)'>确 定</a>"; if(type>1){html+=" <a href='javascript:void(0)'>取 消</a>";} html+="</div>"; }
html+="<div class='clear'></div>";
messageDiv.innerHTML=html;
styleStr="left:"+(obj.getClientWidth()- wWidth)/2+"px;position:absolute;width:"+wWidth+"px;z-index:"+window._msgZindex++ +";top:" +((obj.getClientHeight()-100)/2+obj.getScrollTop()) +'px';
messageDiv.style.cssText=styleStr;
document.body.appendChild(messageDiv);
setTimeout(function(){
var divList =messageDiv.getElementsByTagName('div') ;