去百度一下"仿QQ提示信息"之类的代码就有了
送你一个,至于怎么使用! 不会也别问我了..兼容IE7
- <html>
- <title>Htmlrss Group</title>
- <SCRIPT language=javascript>
- window.onload = enetgetMsg;
- window.onresize = enetresizeDiv;
- window.onerror = function(){}
- var
- enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i
- = 0;
- //主函数,初始化enetMeng的位置并设置移动的时间间隔
- function enetgetMsg()
- {
- try{
- //parseInt 方法,返回由字符串转换得到的整数。
- enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
- enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10)
- enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
- enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
- enetdocWidth = document.body.clientWidth;
- enetdocHeight = document.body.clientHeight;
- document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) +
- enetdocHeight + 10;// enetdivHeight
- document.getElementById("enetMeng").style.left = parseInt(document.body.scrollLeft,10) +
- enetdocWidth - enetdivWidth
- document.getElementById("enetMeng").style.visibility="visible"
- enetobjTimer = window.setInterval("enetmoveDiv()",10)
- }
- catch(e){}
- }
- //enetMeng到达指定位置后调用该函数,在指定时间内进行隐藏并在隐藏之前固定了它的当前位置
- function enetresizeDiv()
- {
- i+=1
- if(i>600) enetcloseDiv()
- try{
- enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
- enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
- enetdocWidth = document.body.clientWidth;
- enetdocHeight = document.body.clientHeight;
- document.getElementById("enetMeng").style.top = enetdocHeight - enetdivHeight + parseInt
- (document.body.scrollTop,10)
- document.getElementById("enetMeng").style.left = enetdocWidth - enetdivWidth + parseInt
- (document.body.scrollLeft,10)
- }
- catch(e){}
- }
- //进行位置移动
- function enetmoveDiv()
- {
- try
- {
- if(parseInt(document.getElementById("enetMeng").style.top,10) <= (enetdocHeight -
- enetdivHeight + parseInt(document.body.scrollTop,10)))
- {
- window.clearInterval(enetobjTimer)
- enetobjTimer = window.setInterval("enetresizeDiv()",1)
- }
- enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
- document.getElementById("enetMeng").style.top = enetdivTop - 1
- }
- catch(e){}
- }
- //隐藏enetMeng并释放时钟
- function enetcloseDiv()
- {
- document.getElementById('enetMeng').style.visibility='hidden';
- if(enetobjTimer) window.clearInterval(enetobjTimer)
- }
- </SCRIPT>
- <body>
- <DIV id=enetMeng
- style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT:
- 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 241px; BORDER-BOTTOM:
- #455690 1px solid; POSITION: absolute; TOP: -200px; HEIGHT: 157px">
- <TABLE WIDTH=255 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#DAE6FC">
- <TR><TD height="30" valign="top" background="qqimages/heihei_1.jpg">
- <table width="255" height="19" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="212" valign="bottom"><strong><font size="2" color="#FF6600">提示
- </font></strong></td>
- <td width="43" style="cursor:hand" onClick="enetcloseDiv()"><font size="2"
- color="#FF6600">X</font></td>
- </tr>
- </table>
- </TD></TR>
- <TR><TD height="122" valign="top">
- <table width="100%" border="0" cellspacing="0" cellpadding="1">
- <tr><td width="95%">
- <table align="center" width="98%">
- <tr><td>
- Welcome to Htmlrss Group
- </td><tr>
- </table>
- </td></tr>
- </table>
- </TD></TR>
- <TR><TD></TD>
- </TR>
- </TABLE>
- </DIV>
- </body>
- </html>
复制代码
[ 本帖最后由 htmlrss 于 2007-7-11 08:08 编辑 ] |