看下这个就知道 了:var msg="这里是测试消息提示窗口!"; var TITLE_TEXT="消息提示";//默认标题 var CLOSE_TEXT="确定"; var WIDTH=400;//宽度 var HEIGHT=110;//高度 var TITLEHEIGHT=25;//标题高度 var BORDERCOLOR="#336699";//边框颜色 var TITLECOLOR="#99CCFF";//标题颜色function ShowMsg(str1,str2) { if(str1!=null) msg=str1; if(str2!=null) TITLE_TEXT=str2; var sWIDTH=document.body.offsetWidth;//浏览器工作区域内页面宽度 var sHEIGHT=screen.Height;//屏幕高度
popupWindow.popup.document.body.attachEvent("onclick",aa);function aa(){
clearTimeout(mytime);
popupWindow.popup.hide();
popupWindow.number = 1 ;
}
var TITLE_TEXT="消息提示";//默认标题
var CLOSE_TEXT="确定";
var WIDTH=400;//宽度
var HEIGHT=110;//高度
var TITLEHEIGHT=25;//标题高度
var BORDERCOLOR="#336699";//边框颜色
var TITLECOLOR="#99CCFF";//标题颜色function ShowMsg(str1,str2) {
if(str1!=null)
msg=str1;
if(str2!=null)
TITLE_TEXT=str2; var sWIDTH=document.body.offsetWidth;//浏览器工作区域内页面宽度
var sHEIGHT=screen.Height;//屏幕高度
var bgObj=document.createElement("div");//遮罩层
bgObj.setAttribute('id','bgDiv');
bgObj.style.position="absolute";
bgObj.style.top="0";
bgObj.style.background="#777777";
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);//
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="40%";
msgObj.style.font="12px Verdana,Geneva,Arial";
msgObj.style.marginLeft="-225px";
msgObj.style.marginTop=-75+document.documentElement.scrollTop+"px";
msgObj.style.width=WIDTH+"px";
msgObj.style.height=HEIGHT+"px";
msgObj.style.textAlign="center";
msgObj.style.lineHeight="25px";
msgObj.style.zIndex="10001";
document.body.appendChild(msgObj);
var title=document.createElement("h4");//标题
title.setAttribute("id","msgTitle");
title.setAttribute("align","left");
title.style.cursor="default";
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=100,finishOpacity=75);";
title.style.opacity="0.75";
title.style.border="1px solid "+BORDERCOLOR;
title.style.height=TITLEHEIGHT+"px";
title.style.font="14 px Verdana,Geneva,Arial";
title.style.color="white";
title.innerHTML=TITLE_TEXT;
document.getElementById("msgDiv").appendChild(title);
var closebtn=document.createElement("div");//右上角关闭按钮
closebtn.innerHTML=" × ";
closebtn.style.right="0";
closebtn.style.top="0";
closebtn.style.position="absolute";
closebtn.style.zIndex="10002";
closebtn.style.cursor="pointer";
closebtn.style.font="18 px Verdana,Geneva,Arial";
closebtn.style.color="white";
closebtn.onclick=Close;
function Close() {
document.body.removeChild(bgObj);
document.body.removeChild(msgObj);
}
document.getElementById("msgDiv").appendChild(closebtn);
var text=document.createElement("p");
text.style.margin="1em 0";
text.setAttribute("id","msgTxt");
text.innerHTML=msg;
text.style.cursor="default";
document.getElementById("msgDiv").appendChild(text);
var closebtn2=document.createElement("input");//关闭按钮
closebtn2.setAttribute("value",CLOSE_TEXT);
closebtn2.setAttribute("type","button");
closebtn2.style.position="absolute";
closebtn2.style.left="48%";
closebtn2.style.bottom="3px";
closebtn2.style.border=BORDERCOLOR+" 1px solid";
closebtn2.style.filter=" FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde)";
//closebtn2.style.backgroundColor=BORDERCOLOR;
closebtn2.style.padding="2px 3px 0px 3px";
closebtn2.onclick=Close;
document.getElementById("msgDiv").appendChild(closebtn2);
}