ASP.NET 弹出提示窗口,像QQ那种 在asp.net中,怎么样可以在登陆系统后自动弹出一个提示窗口,之后在规定的时间内消失。像QQ在电脑右下角会弹出提示窗口那样 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 提示框用div做,获取消息就要定时刷新了! 这个要用JS做的;有点复杂..如果会JS又会写CSS的话那就好办了.. <style type="text/css"><!--#xx{ position:absolute; width:200px;;border:1px solid #999999;}#title{font-size:12px;height:30px;width:100%;background:#0099FF;}#content{font-size:12px;height:170px;width:100%;}--></style><script>var Initialization =true //判断div是否滚动下去了 true没下去 false下去了var Opacity =100 //设置透明度var i=0 //移动的次数 根据长度算和移动速度算出来的window.onresize = resizeDiv;window.onscroll = resizeDiv;function resizeDiv(){divHeight = parseInt(document.getElementById("xx").offsetHeight,10);divWidth = parseInt(document.getElementById("xx").offsetWidth,10);docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;if(Initialization){document.getElementById("xx").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight ;document.getElementById("xx").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth;}else{document.getElementById("xx").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight;}}function move(){if(Initialization) { if(i!=34) { i++; document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top)+5 tt=setTimeout("move()",10) } else {window.clearTimeout(tt); Initialization=false;document.getElementById("content").style.display = "none";}}else{ if(i!=0) { document.getElementById("content").style.display = ""; i-- document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top)-5 tt=setTimeout("move()",10) } else {Initialization=true;window.clearTimeout(tt)}}}function disappear(){if(Opacity==0){window.clearTimeout(time);document.getElementById('xx').style.display="none";}else{Opacity=Opacity-10;document.getElementById('xx').style.filter = "Alpha(opacity="+Opacity+")";time=setTimeout("disappear()",50)}}</script> <body onload="resizeDiv()">hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br><div id="xx"><div id="title"><span style="top:7px;left:10px; position:relative;">新闻列表</span><span style="top:7px;left:105px; position:relative; cursor:hand;" onClick="move()">--</span><span style="top:7px;left:110px; position:relative; cursor:hand;" onClick="disappear()">X</span></div><div id="content"></div></div></body> 就是这个方法 然后在settimeout 调用的事件中 style="display:none" <!-- saved from url=file://C:/Documents and Settings/yfq/桌面/升起窗口提示.html --><script>window.onerror = new Function("return(false);")</script><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE>类似MSN提示的页面效果</TITLE></HEAD><BODY scroll=no><!--StartFragment-->看到右下角的提示了吗?如果没有看到,<BUTTON onclick=location.reload();>刷新</BUTTON>一下<SCRIPT language=JavaScript>window.onload = getMsg;window.onresize = resizeDiv;window.onerror = function(){}//短信提示使用(asilas添加)var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;function getMsg(){ try{ divTop = parseInt(document.getElementById("eMeng").style.top,10) divLeft = parseInt(document.getElementById("eMeng").style.left,10) divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) docWidth = document.body.clientWidth; docHeight = document.body.clientHeight; document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth document.getElementById("eMeng").style.visibility="visible" objTimer = window.setInterval("moveDiv()",10) } catch(e){}}function resizeDiv(){ i+=1 if(i>500) closeDiv() try{ divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) docWidth = document.body.clientWidth; docHeight = document.body.clientHeight; document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10) document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10) } catch(e){}}function moveDiv(){ try { if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))) { window.clearInterval(objTimer) objTimer = window.setInterval("resizeDiv()",1) } divTop = parseInt(document.getElementById("eMeng").style.top,10) document.getElementById("eMeng").style.top = divTop - 1 } catch(e){}}function closeDiv(){ document.getElementById('eMeng').style.visibility='hidden'; if(objTimer) window.clearInterval(objTimer)}</SCRIPT> <DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 840px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 483px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0><TBODY><TR><TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #0f2c8c" width=30 height=24></TD><TD style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #1f336b; PADDING-TOP: 4px" vAlign=center width="100%">短消息提示: </TD><TD style="PADDING-RIGHT: 2px; BACKGROUND-IMAGE: url(msgTopBg.gif); PADDING-TOP: 2px" vAlign=center align=right width=19><SPAN title=关闭 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" onclick=closeDiv()>× </SPAN><!-- <IMG title=关闭 style="CURSOR: hand" onclick=closeDiv() hspace=3 src="msgClose.jpg"> --></TD></TR><TR><TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px" colSpan=3 height=90><DIV style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">您有 <FONT color=#ff0000>1 </FONT>封新短消息 <BR><BR><DIV style="WORD-BREAK: break-all" align=center><A href="javascript:alert('你好')"><FONT color=#ff0000>点击查看短信 </FONT></A></DIV></DIV></TD></TR></TBODY></TABLE></DIV><!--EndFragment--></BODY></HTML> http://cn-asp.net/n38c11.aspx这个很漂亮的! 有个控件叫popupwin控件蛮不错的,你可以下载来试试。 网上很多资料的,去cnblog搜索下,我的东西就是在那里找的,然后自已改了点东西 popupwin控件,到网上搜一下 优化SQL asp.net button 问题 这2本书如何????我刚下载的。。先看看意见 IIS服务器第一次打开网站慢 listbox能否设置成像windows文件管理那样.的详细模式.有多列,有列名,有不同的属性 动态生成DIV后怎样设置属性 怎么解决用OWC通过访问OLAP数据库的N个问题? 我做的中文网站移到英文系统的服务器后都变成乱码了。 可能是老问题了,不知道大家是怎么做的? 如何在后台写控件? 问一个ADO.NET的小问题 ajax事件该何时增加,Pageload()?,或其他控件的响应事件程序?
<style type="text/css">
<!--
#xx{ position:absolute; width:200px;;border:1px solid #999999;}
#title{font-size:12px;height:30px;width:100%;background:#0099FF;}
#content{font-size:12px;height:170px;width:100%;}
-->
</style>
<script>
var Initialization =true //判断div是否滚动下去了 true没下去 false下去了
var Opacity =100 //设置透明度
var i=0 //移动的次数 根据长度算和移动速度算出来的
window.onresize = resizeDiv;
window.onscroll = resizeDiv;
function resizeDiv()
{
divHeight = parseInt(document.getElementById("xx").offsetHeight,10);
divWidth = parseInt(document.getElementById("xx").offsetWidth,10);
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
if(Initialization)
{document.getElementById("xx").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight ;
document.getElementById("xx").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth;}
else
{
document.getElementById("xx").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight;
}
}function move(){
if(Initialization)
{ if(i!=34)
{
i++;
document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top)+5
tt=setTimeout("move()",10)
}
else
{window.clearTimeout(tt); Initialization=false;document.getElementById("content").style.display = "none";}
}
else
{
if(i!=0)
{
document.getElementById("content").style.display = "";
i--
document.getElementById("xx").style.top=parseInt(document.getElementById("xx").style.top)-5
tt=setTimeout("move()",10)
}
else
{Initialization=true;window.clearTimeout(tt)}
}
}function disappear(){
if(Opacity==0)
{window.clearTimeout(time);
document.getElementById('xx').style.display="none";}
else
{
Opacity=Opacity-10;
document.getElementById('xx').style.filter = "Alpha(opacity="+Opacity+")";
time=setTimeout("disappear()",50)
}
}
</script> <body onload="resizeDiv()">
hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>hehe<br>
<div id="xx">
<div id="title">
<span style="top:7px;left:10px; position:relative;">新闻列表</span>
<span style="top:7px;left:105px; position:relative; cursor:hand;" onClick="move()">--</span>
<span style="top:7px;left:110px; position:relative; cursor:hand;" onClick="disappear()">X</span>
</div>
<div id="content"></div>
</div>
</body>
然后在settimeout 调用的事件中 style="display:none"
<script>
window.onerror = new Function("return(false);")
</script><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><TITLE>类似MSN提示的页面效果</TITLE></HEAD><BODY scroll=no><!--StartFragment-->看到右下角的提示了吗?如果没有看到,<BUTTON onclick=location.reload();>刷新</BUTTON>一下
<SCRIPT language=JavaScript>
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}
//短信提示使用(asilas添加)
var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
document.getElementById("eMeng").style.visibility="visible"
objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}function resizeDiv()
{
i+=1
if(i>500) closeDiv()
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
}
catch(e){}
}function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
</SCRIPT>
<DIV id=eMeng
style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 840px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 483px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
<TBODY>
<TR>
<TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #0f2c8c"
width=30 height=24></TD>
<TD
style="PADDING-LEFT: 4px; FONT-WEIGHT: normal; FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #1f336b; PADDING-TOP: 4px"
vAlign=center width="100%">短消息提示: </TD>
<TD
style="PADDING-RIGHT: 2px; BACKGROUND-IMAGE: url(msgTopBg.gif); PADDING-TOP: 2px"
vAlign=center align=right width=19><SPAN title=关闭
style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px"
onclick=closeDiv()>× </SPAN><!-- <IMG title=关闭 style="CURSOR: hand" onclick=closeDiv() hspace=3 src="msgClose.jpg"> --></TD></TR>
<TR>
<TD
style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px"
colSpan=3 height=90>
<DIV
style="BORDER-RIGHT: #b9c9ef 1px solid; PADDING-RIGHT: 13px; BORDER-TOP: #728eb8 1px solid; PADDING-LEFT: 13px; FONT-SIZE: 12px; PADDING-BOTTOM: 13px; BORDER-LEFT: #728eb8 1px solid; WIDTH: 100%; COLOR: #1f336b; PADDING-TOP: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">您有
<FONT color=#ff0000>1 </FONT>封新短消息 <BR><BR>
<DIV style="WORD-BREAK: break-all" align=center><A
href="javascript:alert('你好')"><FONT color=#ff0000>点击查看短信
</FONT></A></DIV></DIV></TD></TR></TBODY></TABLE></DIV><!--EndFragment--></BODY>
</HTML>
这个很漂亮的!