﻿function sAlert(Url,Width,Height){
   var msgw,msgh,bordercolor;
   msgw=Width;//提示窗口的宽度
   msgh=Height;//提示窗口的高度
   bordercolor="#336699";//提示窗口的边框颜色
   titlecolor="#99CCFF";//提示窗口的标题颜色

   var sWidth,sHeight;
   sWidth=document.documentElement.scrollWidth;//浏览器工作区域内页面宽度
   sHeight=document.documentElement.scrollHeight;//屏幕高度（垂直分辨率）

   //背景层（大小与窗口有效区域相同，即当弹出对话框时，背景显示为放射状透明灰色）
   var bgObj=document.createElement("div");//创建一个div对象（背景层）
   //定义div属性，即相当于
   //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></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";
   bgObj.onclick=removeObj;
   document.body.appendChild(bgObj);//在body内添加该div对象

      
   var msgObj=document.createElement("div")//创建一个div对象（提示框层）
   //定义div属性，即相当于
   //<div id="msgDiv" align="center" style="background-color:white; border:1px solid #336699; position:absolute; left:50%; top:50%; font:12px/1.6em Verdana,Geneva,Arial,Helvetica,sans-serif; margin-left:-225px; margin-top:npx; width:400px; height:100px; text-align:center; line-height:25px; z-index:100001;"></div>
   msgObj.setAttribute("id","msgDiv");
   msgObj.setAttribute("align","center");
   msgObj.style.background="white";
   msgObj.style.border="0px 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 = "-225px" ;
   msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
   msgObj.style.width = msgw + "px";
   msgObj.style.height =msgh + "px";
   msgObj.style.textAlign = "center";
   msgObj.style.lineHeight ="25px";
   msgObj.style.zIndex = "10001";
   
   var tObj=document.createElement("div");//创建一个div对象（标题层）
   tObj.setAttribute("id","ttDiv");
   tObj.setAttribute("align","right");
   tObj.style.textAlign = "right";
   tObj.innerHTML="<span onclick='javascript:removeObj()'>关闭</span>&nbsp;&nbsp;";   
   tObj.style.background="#0606a5";     
   tObj.style.color="#ffffff";     
   tObj.setAttribute("width","100%");
   tObj.style.height="20px"; 
   
   var ifremeObj=document.createElement("iframe");//创建一个ifeame对象
   ifremeObj.setAttribute("src",Url);
   ifremeObj.setAttribute("frameBorder","0");
   ifremeObj.setAttribute("marginHeight","0");
   ifremeObj.setAttribute("marginWidth","0");
   ifremeObj.setAttribute("width","100%");
   ifremeObj.setAttribute("height","100%");


   document.body.appendChild(msgObj);//在body内添加提示框div对象msgObj
   document.getElementById("msgDiv").appendChild(tObj);//在body内添加该div对象
   document.getElementById("msgDiv").appendChild(ifremeObj);//在提示框div中添加按钮对象button   
}

function removeObj(){//点击标题栏触发的事件
     document.body.removeChild(document.getElementById("bgDiv"));//删除背景层Div
     document.body.removeChild(document.getElementById("msgDiv"));//删除提示框层
}
   