div居中显示 div弹出框 alert(渐渐消失)

先看效果

div居中显示 div弹出框 alert(渐渐消失)

前台代码

<% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " div弹出居中.aspx.cs "  Inherits = " div弹出居中 "   %>

<! DOCTYPE html PUBLIC  " -//W3C//DTD XHTML 1.0 Transitional//EN "   " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " >
< html xmlns = " http://www.w3.org/1999/xhtml " >
< head runat = " server " >
    
< title > 无标题页 </ title >

    
< script src = " scripts/jquery-1.3.2.min.js "  type = " text/javascript " ></ script >

    
< script language = " javascript "  type = " text/javascript " >
function divcenter(i)
{
var divId
= document.getElementById( ' div1sss ' );
document.getElementById(
' div1sss ' ).innerHTML = i;
document.getElementById(
" div1sss " ).style.display = " block " ;
 $(
" #div1sss " ).fadeOut( 13000 ,function(){}); 

}

function attachWindowEventHandler(
event ,func)
  {
    
if (navigator.appName  ==   ' Netscape '
    {
          window.addEventListener(
event ,func, false ); 
   }
   
else  
   { 
         window.attachEvent(
' onload ' ,func);
   }
 } 
    
</ script >

    
< style type = " text/css " >
        #div1sss
        {
            position: absolute;
            top: 
50 % ;
            left: 
50 % ;
            margin
- top:  - 25px;
            margin
- left:  - 150px;
            color: blue;
            width: 300px;
            height: 50px;
            font
- weight: bold;
            border: solid 1px gray;
            line
- height: 50px;
            font
- size: 20px;
            text
- align: center; </ style >
</ head >
< body >
    
< form id = " form1 "  runat = " server " >
    
< table width = " 100% " >
        
< tr >
            
< td >
                
< asp:Button ID = " Button1 "  runat = " server "  Text = " Button "  OnClick = " Button1_Click "   />
                
< span onclick = " divcenter() " > test </ span >
            
</ td >
        
</ tr >
     
    
</ table >
    
< div id = " div1sss "  style = " display: none; position: absolute; background-color: yellow; " >
    
</ div >
      
</ form >
  
</ body >
</ html >

后台代码

 protected void Button1_Click(object sender, EventArgs e)
    {
        Utility.MessageBox.AlertScript("attachWindowEventHandler('',function(){divcenter('成功');})");
    }

你可能感兴趣的:(alert)