仿MSN 弹出提示信息的脚本改进版
来源:BeanSoft's Java Blog
作者:
时间:2007-10-19
点击:
, 193 , 108 );
}
popTop += 10 ;
mytime = setTimeout( " popshow(); " , 40 );
}
function hidePop() {
clearTimeout(mytime);
oPopup.hide();
}
popmsg( " <div onclick='window.parent.hidePop()' title='点击隐藏' style='cursor:pointer; background-image: url(http://www.blogjava.net/images/blogjava_net/beansoft/18269/o_qqbg.gif); width:193; height:108; color:white; padding-top:1em; padding-left:5; font-size:11pt; color:white' ><center><b>BlogJava 系统消息<br><br>请留言或者捐款支持 BeanSoft 的 Java EE 学习视频, 谢谢 !!</b></center></div> " );
</ SCRIPT >
最后来一个支持页面内的跨浏览器的:
完美仿MSN右下角弹出广告代码并可自动消失,附带关闭按钮.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>先飞电脑技术网</title>
</head>
<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>300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)