我实现在右下角弹出消息框的效果,出现的时候是从下往上缓慢出现的,可是关闭的时候一点关闭很快关闭了,大家帮帮忙,如何实现逐渐从上往下退出关闭的效果。
现在是这样写的:
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
现在是这样写的:
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
解决方案 »
- 关于网站发布问题
- 论友进来看下!!!!!!!!!
- .net下如何将表格直接导出成word文档?
- 相对地址与相同目录地址,麻烦的问题~!!!!!!从来没见过这种问题~!!!!!
- 从shtml中提交表单时,获取按钮值的问题,急请各位查看
- 树,求教!
- asp.net 1.x 页面的提交
- 从objectdatasource中得到datatable
- asp.net + c#,一个cs文件一个dll,可以做到吗?
- asp.net和以前的asp是什么关系,是不是可以不用学asp了,直接学asp.net就可以了
- c# ObjectDataSource updating 参数
- 求助关于asp.net的在线视频播放缓冲的问题,FLV格式的!欢迎来讨论
var MsgPop=document.getElementById("winpop");
var popH=parseInt(MsgPop.style.height);
if(str=="up"){
if (popH<=180){
MsgPop.style.height=(popH+4).toString()+"px";
}
else{
clearInterval(show);
}
}
if(str=="down"){
if (popH>=4){
MsgPop.style.height=(popH-4).toString()+"px";
}
else{
clearInterval(hide);
MsgPop.style.display="none"; //隐藏DIV
}
}
}用这个方法
:
function tips_pop(){
show=setInterval("changeH('up')",2);
}
else {
hide=setInterval("changeH('down')",2);}
调用
tips_pop()就行了
{
div 宽度-1
判断下如果==0 就
document.getElementById('eMeng').style.visibility='hidden';
clearInterval();
}setInterval(changeSmall,1000);
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="Keywords" content="51windows.Net">
<meta name="Author" content="haiwa">
<title>类似MSN提示的页面效果</title>
</head>
<body scroll="no">
看到右下角的提示了吗?如果没有看到,
<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: 0px; visibility: hidden; border-left: #a6b4cf 1px solid;
width: 180px; border-bottom: #455690 1px solid; position: absolute; top: 0px;
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="font-weight: normal; font-size: 12px; background-image: url(msgTopBg.gif);
color: #1f336b; padding-top: 4px; padding-left: 4px" valign="center" width="100%">
短消息提示:
</td>
<td style="background-image: url(msgTopBg.gif); padding-top: 2px; padding-right: 2px"
valign="center" align="right" width="19">
<span title="关闭" style="cursor: hand; color: red; font-size: 12px; font-weight: bold;
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 align="center" style="word-break: break-all">
<a href="javascript:alert('你好')"><font color="#FF0000">点击查看短信</font></a></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>