不一样的Alert();

自定义弹窗效果
  1None.gif<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2None.gif<html>
  3None.gif    <head>
  4None.gif        <title></title>
  5None.gif        <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
  6None.gif        <meta name="ProgId" content="VisualStudio.HTML">
  7None.gif        <meta name="Originator" content="Microsoft Visual Studio .NET 7.1">
  8None.gif        <script language="javascript" type="text/javascript">
  9None.gif
 10None.gif//Author:Daviv
 11None.gif//Blog:http://blog.163.com/jxdawei
 12None.gif//Date:2006-10-27
 13None.gif//Email:jxdawei@gmail.com
 14None.gif
 15ExpandedBlockStart.gifContractedBlock.gif            function sAlert(str)dot.gif{
 16InBlock.gif            var msgw,msgh,bordercolor;
 17InBlock.gif            msgw=400;//提示窗口的宽度
 18InBlock.gif            msgh=100;//提示窗口的高度
 19InBlock.gif            titleheight=25 //提示窗口标题高度
 20InBlock.gif            bordercolor="#336699";//提示窗口的边框颜色
 21InBlock.gif            titlecolor="#99CCFF";//提示窗口的标题颜色
 22InBlock.gif            
 23InBlock.gif            var sWidth,sHeight;
 24InBlock.gif            sWidth=document.body.offsetWidth;
 25InBlock.gif            sHeight=document.body.scrollHeight;
 26InBlock.gif
 27InBlock.gif            var bgObj=document.createElement("div");
 28InBlock.gif            bgObj.setAttribute('id','bgDiv');
 29InBlock.gif            bgObj.style.position="absolute";
 30InBlock.gif            bgObj.style.top="0";
 31InBlock.gif            bgObj.style.background="#777";
 32InBlock.gif            bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";
 33InBlock.gif            bgObj.style.opacity=0.6;
 34InBlock.gif            bgObj.style.left="0";
 35InBlock.gif            bgObj.style.width=sWidth + "px";
 36InBlock.gif            bgObj.style.height=sHeight + "px";
 37InBlock.gif            bgObj.style.zIndex = "10000";
 38InBlock.gif            document.body.appendChild(bgObj);
 39InBlock.gif            
 40InBlock.gif            var msgObj=document.createElement("div")
 41InBlock.gif            msgObj.setAttribute("id","msgDiv");
 42InBlock.gif            msgObj.setAttribute("align","center");
 43InBlock.gif            msgObj.style.background="white";
 44InBlock.gif            msgObj.style.border="1px solid " + bordercolor;
 45InBlock.gif            msgObj.style.position = "absolute";
 46InBlock.gif            msgObj.style.left = "50%";
 47InBlock.gif            msgObj.style.top = "50%";
 48InBlock.gif            msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
 49InBlock.gif            msgObj.style.marginLeft = "-225px" ;
 50InBlock.gif            msgObj.style.marginTop = -75+document.documentElement.scrollTop+"px";
 51InBlock.gif            msgObj.style.width = msgw + "px";
 52InBlock.gif            msgObj.style.height =msgh + "px";
 53InBlock.gif            msgObj.style.textAlign = "center";
 54InBlock.gif            msgObj.style.lineHeight ="25px";
 55InBlock.gif            msgObj.style.zIndex = "10001";
 56InBlock.gif   
 57InBlock.gif           var title=document.createElement("h4");
 58InBlock.gif           title.setAttribute("id","msgTitle");
 59InBlock.gif           title.setAttribute("align","right");
 60InBlock.gif           title.style.margin="0";
 61InBlock.gif           title.style.padding="3px";
 62InBlock.gif           title.style.background=bordercolor;
 63InBlock.gif           title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);";
 64InBlock.gif           title.style.opacity="0.75";
 65InBlock.gif           title.style.border="1px solid " + bordercolor;
 66InBlock.gif           title.style.height="18px";
 67InBlock.gif           title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
 68InBlock.gif           title.style.color="white";
 69InBlock.gif           title.style.cursor="pointer";
 70InBlock.gif          // title.innerHTML="关闭";
 71ExpandedSubBlockStart.gifContractedSubBlock.gif           title.onclick=function()dot.gif{
 72InBlock.gif               
 73ExpandedSubBlockEnd.gif                }

 74InBlock.gif           document.body.appendChild(msgObj);
 75InBlock.gif           document.getElementById("msgDiv").appendChild(title);
 76InBlock.gif           var txt=document.createElement("p");
 77InBlock.gif           txt.style.margin="1em 0"
 78InBlock.gif           txt.setAttribute("id","msgTxt");
 79InBlock.gif           txt.innerHTML=str;
 80InBlock.gif          txt.innerHTML+=" <img src='loader.gif'>";
 81InBlock.gif        
 82InBlock.gif           document.getElementById("msgDiv").appendChild(txt);
 83InBlock.gif           a(0);
 84ExpandedBlockEnd.gif           }

 85None.gif           function a(i)
 86ExpandedBlockStart.gifContractedBlock.gif        dot.gif{
 87InBlock.gif            if(i<50)
 88ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 89InBlock.gif            document.getElementById("bgDiv").style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+i+")"
 90InBlock.gif                
 91InBlock.gif                 i+=10;
 92InBlock.gif                 setTimeout("a("+i+")",100);
 93ExpandedSubBlockEnd.gif            }

 94ExpandedBlockEnd.gif        }

 95None.gif        </script>
 96None.gif    </head>
 97None.gif    <body>
 98None.gif        <div onclick="sAlert('要打的字')">点击</div>
 99None.gif    </body>
100None.gif</html>
101None.gif

转载于:https://www.cnblogs.com/suneryong/archive/2007/05/29/764160.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值