• 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;
                 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('成功');})");
        }

  • 相关阅读:
    javascript数组查重方法总结
    html5的web存储
    掌握javascript中的最基础数据结构-----数组
    ES解决geoip的location不为geo_point格式
    elk默认分片只有1000导致索引没有创建
    Polysh批量管理服务器
    Git永久删除文件和历史记录
    windows下设置JupyterNotebook默认目录
    windwos安装RabbitMQ
    win7计划任务报该任务映像己损坏或己篡改
  • 原文地址:https://www.cnblogs.com/aaa6818162/p/1522992.html
Copyright © 2020-2023  润新知