网站右下角消息提示JS代码

0.0/0人
免费

更新时间:2022-11-26 01:24:25

所属分类:其他资源

评论回复:0

 

暂无演示 下载权限

网站右下角消息提示JS代码-第3张插图

网站右下角缓缓升起的信息提示框,可以用来做广告或者公告等用途。

  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  4. <meta name="Keywords" content="51windows.Net">
  5. <META NAME="Author" CONTENT="haiwa">
  6. <title>类似MSN提示的页面效果</title>
  7. </head>
  8. <body scroll=no>
  9. 看到右下角的提示了吗如果没有看到,<button onclick=location.reload();>刷新</button>一下
  10. <script language="JavaScript">
  11. window.onload = getMsg;
  12. window.onresize = resizeDiv;
  13. window.onerror = function(){}
  14. //短信提示使用(asilas添加)
  15. var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
  16. function getMsg()
  17. {
  18. try{
  19. divTop = parseInt(document.getElementById("eMeng").style.top,10)
  20. divLeft = parseInt(document.getElementById("eMeng").style.left,10)
  21. divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
  22. divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
  23. docWidth = document.body.clientWidth;
  24. docHeight = document.body.clientHeight;
  25. document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
  26. document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
  27. document.getElementById("eMeng").style.visibility="visible"
  28. objTimer = window.setInterval("moveDiv()",10)
  29. }
  30. catch(e){}
  31. }
  32. function resizeDiv()
  33. {
  34. i+=1
  35. if(i>500) closeDiv()
  36. try{
  37. divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
  38. divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
  39. docWidth = document.body.clientWidth;
  40. docHeight = document.body.clientHeight;
  41. document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
  42. document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
  43. }
  44. catch(e){}
  45. }
  46. function moveDiv()
  47. {
  48. try
  49. {
  50. if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
  51. {
  52. window.clearInterval(objTimer)
  53. objTimer = window.setInterval("resizeDiv()",1)
  54. }
  55. divTop = parseInt(document.getElementById("eMeng").style.top,10)
  56. document.getElementById("eMeng").style.top = divTop - 1
  57. }
  58. catch(e){}
  59. }
  60. function closeDiv()
  61. {
  62. document.getElementById('eMeng').style.visibility='hidden';
  63. if(objTimer) window.clearInterval(objTimer)
  64. }
  65. </script>
  66. <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">
  67. <TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#cfdef4 border=0>
  68. <TBODY>
  69. <TR>
  70. <TD style="FONT-SIZE: 12px; BACKGROUND-IMAGE: url(msgTopBg.gif); COLOR: #0f2c8c" width=30 height=24></TD>
  71. <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>
  72. <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>
  73. </TR>
  74. <TR>
  75. <TD style="PADDING-RIGHT: 1px; BACKGROUND-IMAGE: url(1msgBottomBg.jpg); PADDING-BOTTOM: 1px" colSpan=3 height=90>
  76. <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>
  77. <DIV align=center style="word-break:break-all"><a href="javascript:alert('你好')"><font color=#FF0000>点击查看短信</font></a></DIV>
  78. </DIV>
  79. </TD>
  80. </TR>
  81. </TBODY>
  82. </TABLE>
  83. </DIV>
  84.  
  85. </body>
  86. <div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';clear:both;"><br>
  87. <p>适用浏览器:IE8360FireFoxChromeSafariOpera、傲游、搜狗、世界之窗.</p>
  88. <p>来源:<a href="http://www.xx8g.com" target="_blank">小高教学网</a></p>
  89. </div>
  90. </html>

百度
- MB

相关推荐

首页 导航 会员 客服