div居中显示 div弹出框 alert(渐渐消失)
2009-07-14 09:39
351 查看
先看效果
前台代码
<%@ 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('成功');})");
}
前台代码
<%@ 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('成功');})");
}
相关文章推荐
- jQuery弹出Div窗口居中显示、滚动跟随、关闭按钮以及几秒后自动消失
- js-div遮罩层、div弹出层居中(遮罩层居中显示)
- div代替window.alert,让这个div显示信息后,在指定之间时间内消失
- 使弹出div的文职居中显示
- Js制作简单弹出层DIV在页面居中 中间显示遮罩的具体方法
- 如何设置图片、文字在容器(div)中垂直居中的显示?
- Css控制div水平垂直居中显示
- div的显示和消失
- 如何使 一个 div 居中显示
- GetSaveFileName弹出文件选择框居中显示
- 将一个div中的两个P元素同一行居中显示
- 仿Discuz!的论坛评分发帖弹出提示并渐渐消失的效果
- 纯css解决position:abusolute的div居中显示
- 让文字在div中垂直居中显示
- js让弹出新窗口居中显示的脚本
- frame框架top页面单击按钮显示弹出div的解决方案
- WebBrowser控件中截获用alert、msgbox等弹出的对话框,获取其内容并将其屏蔽,不予显示
- js弹出的对话窗口永远保持居中显示
- 不用alert弹出窗口的方法来显示验证信息
- html 弹出div实现移动居中非常好用