• JAVASCRIPT 弹出层


    tag:Javascript 弹出窗口 弹出层 模式对话框 

    function sAlert(str,time){
       var msgw,msgh,bordercolor;
       msgw=400;//Width
       msgh=100;//Height
       titleheight=25 //title Height
       bordercolor="#336699";//boder color
       titlecolor="#99CCFF";//title color
       var sWidth,sHeight;
       sWidth=document.body.offsetWidth;
       sHeight=screen.height;
       var bgObj=document.createElement("div");
       bgObj.setAttribute('id','bgDiv');
       bgObj.style.position="absolute";
       bgObj.style.top="0";
       bgObj.style.background="#000";
       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 = "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 title=document.createElement("h4");
       title.setAttribute("id","msgTitle");
       title.setAttribute("align","center");
       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";
     
       var waitMsg="请等待... ";
      
       title.innerHTML=waitMsg;
       var sec=time;
       var clearAlertFun=function(){
                document.body.removeChild(bgObj);
                document.getElementById("msgDiv").removeChild(title);
                document.body.removeChild(msgObj);
              }
       timerID=window.setInterval(function(){
       try{
       if(sec<0){
        title.onclick=clearAlertFun;
         title.style.cursor="pointer";
              window.clearInterval(timerID);
              document.getElementById("msgTitle").innerHTML='操作超时,请点击关闭'
       }else
       document.getElementById("msgTitle").innerHTML=waitMsg+sec--+'s';
       }catch(e)
       {
        window.clearInterval(timerID);
       }
      ;},1000);
      
       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);
    }
    function   cAlert()
    {
      document.body.removeChild(document.getElementById("bgDiv"));
            document.getElementById("msgDiv").removeChild(document.getElementById("msgTitle"));
            document.body.removeChild(document.getElementById("msgDiv"));
    }

    修改自:http://www.cnblogs.com/blodfox777/archive/2008/05/26/1207337.html

  • 相关阅读:
    【Unity与Android】02-在Unity导出的Android工程中接入Google AdMob广告
    【Unity与Android】01-Unity与Android交互通信的简易实现
    Unity3D热更新之LuaFramework篇[10]--总结篇
    Unity3D热更新之LuaFramework篇[09]--资源热更新与代码热更新的具体实现
    Unity3D热更新之LuaFramework篇[08]--热更新原理及热更服务器搭建
    Unity3D热更新之LuaFramework篇[07]--怎么让unity对象绑定Lua脚本
    Unity3D热更新之LuaFramework篇[06]--Lua中是怎么实现脚本生命周期的
    Unity3D热更新之LuaFramework篇[05]--Lua脚本调用c#以及如何在Lua中使用Dotween
    Unity3D热更新之LuaFramework篇[04]--自定义UI监听方法
    Unity3d之-使用BMFont制作美术字体
  • 原文地址:https://www.cnblogs.com/yangyh/p/1777685.html
Copyright © 2020-2023  润新知