浮动层居中的对话框效果演示

ContractedBlock.gif ExpandedBlockStart.gif Code
<HTML>
<HEAD>
<TITLE>浮动层居中的对话框效果演示</TITLE>
<STYLE type="text/css">
BODY 
{
 FONT-SIZE
: 14px; FONT-FAMILY: Tahoma, Verdana, sans-serif
}
DIV.neat-dialog-cont 
{
 Z-INDEX
: 98; BACKGROUND: none transparent scroll repeat 0% 0%; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%;
}
DIV.neat-dialog-bg 
{
 Z-INDEX
: -1; FILTER: alpha(opacity=70); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 100%; BACKGROUND-COLOR: #eee; opacity: 0.7
}
DIV.neat-dialog 
{
 BORDER-RIGHT
: #444 1px solid; BORDER-TOP: #444 1px solid; Z-INDEX: 99; --MARGIN-LEFT: auto; BORDER-LEFT: #444 1px solid; WIDTH: 30%; --MARGIN-RIGHT: auto; BORDER-BOTTOM: #444 1px solid; POSITION: relative; TOP: 30%; LEFT: 35%; BACKGROUND-COLOR: #fff
}
DIV.neat-dialog-title 
{
 PADDING-RIGHT
: 0.3em; PADDING-LEFT: 0.3em; FONT-SIZE: 0.8em; PADDING-BOTTOM: 0.1em; MARGIN: 0px; LINE-HEIGHT: 2em; PADDING-TOP: 0.1em; BORDER-BOTTOM: #444 1px solid; POSITION: relative;background:url(sprite.png) repeat-x 0 -200px;
}
IMG.nd-cancel 
{
 RIGHT
: 0.4em; POSITION: absolute; TOP: 0.2em
}
DIV.neat-dialog P 
{
 PADDING-RIGHT
: 0.2em; PADDING-LEFT: 0.2em; PADDING-BOTTOM: 0.2em; PADDING-TOP: 0.2em; TEXT-ALIGN: center
}

</STYLE>

<SCRIPT type="text/javascript">
function NeatDialog(sHTML, sTitle, bCancel)
{
  window.neatDialog 
= null;
  
this.elt = null;
  
if (document.createElement && document.getElementById)
  {
    
var dg = document.createElement("div");
    dg.className 
= "neat-dialog";

    sHTML 
= '<p>' + sHTML + '</p>';
    
if (sTitle)
      sHTML 
= '<div class="neat-dialog-title">'+sTitle+
              ((bCancel)
?
                
'<img id="nd-cancel" src="x.gif" alt="Cancel" class="nd-cancel" />':'')+
                
'</div>\n' + sHTML;

    sHTML 
+= '<p><div align="center"><img src="rel_interstitial_loading.gif"/></div></p>';

    dg.innerHTML 
= sHTML;
    
    
var dbg = document.createElement("div");
    dbg.id 
= "nd-bdg";
    dbg.className 
= "neat-dialog-bg";

    
var ifrm = '<iframe  style="position:absolute;z-index:9;width:expression(this.nextSibling.offsetWidth);'
             
+ 'height:expression(this.nextSibling.offsetHeight);top:expression(this.nextSibling.offsetTop);'
             
+ 'left:expression(this.nextSibling.offsetLeft);" frameborder="0" ></iframe>';
        
    
var dgc = document.createElement("div");
    dgc.className 
= "neat-dialog-cont";
    
    dgc.appendChild(dbg);
             
    dgc.innerHTML 
+= ifrm;
    dgc.appendChild(dg);

    
//alert(document.body.offsetLeft);
    //adjust positioning if body has a margin
    if (document.body.offsetLeft > 0)
      dgc.style.marginLeft 
= document.body.offsetLeft + "px";

    document.body.appendChild(dgc);
    
if (bCancel) document.getElementById("nd-cancel").onclick = function()
    {
      window.neatDialog.close();
    };

    
//alert(document.body.innerHTML);
    this.elt = dgc;
    dgc.focus();
    window.neatDialog 
= this;
    document.body.style.overflow
="visible";
  }
}
NeatDialog.prototype.close 
= function()
{
  
if (this.elt)
  {
    
this.elt.style.display = "none";
    
this.elt.parentNode.removeChild(this.elt);
  }
  window.neatDialog 
= null;
  document.body.style.overflow
="";
}

function openDialog()
  {

var sHTML = '正在执行,请稍候···';
    
new NeatDialog(sHTML, "欢迎光临!"true);
}
  
</SCRIPT>
</HEAD>

<BODY>
<div align="center">
<H1>浮动层居中的对话框效果演示</H1>
<BUTTON onclick="openDialog();">演示层提示效果</BUTTON>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
<BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/><BR/>
</BODY>

</HTML>

转载于:https://www.cnblogs.com/askyes/archive/2008/08/01/1257994.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值