| js+css实现DIV层悬浮的网页右侧的,并且可以关闭,这是一个简单的使用JS+CSS实现的DIV层在网页的右侧浮动,可以上下自动浮动,我们可以把这个层放入广告或者重要信息公告提示等等,还是比较有用的,但是这个浮动的DIV不要多了,有一个就好了:
以下是代码片段: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>网页右侧可关闭的漂浮窗口 敏韬网-Www.MinTao.Net</title> <meta http-equiv="content-type" content="text/html;charset=gb2312"> </head> <body> <div id="ShowAD" style="position:absolute;z-index:100;"> <div style="width:115;height:18px;font-size:14px;font-weight:bold;text-align:left;cursor:hand;" onClick="closead();"><font color="ff0000">关闭</font></div> 这个窗口可以关闭噢?可以放漂浮广告哦!敏韬网-Www.MinTao.Net<br><a href="tencent://message/?uin=543098146&Site=敏韬网-文内&Menu=yes"><img src="http://www.mintao.net/images/kefuqq/qq_yanshi.gif"></a> </div> <script language="javascript"> var bodyfrm = ( document.compatMode.toLowerCase()=="css1compat" ) ? document.documentElement : document.body; var adst = document.getElementById("ShowAD").style; adst.top = ( bodyfrm.clientHeight -468 ) + "px"; adst.left = ( bodyfrm.clientWidth -115 ) + "px"; function moveR() { adst.top = ( bodyfrm.scrollTop + bodyfrm.clientHeight - 468) + "px"; adst.left = ( bodyfrm.scrollLeft + bodyfrm.clientWidth - 115 ) + "px"; } setInterval("moveR();", 80); function closead() { adst.display='none'; } </script> <div id="Content" style="height:900px;">闵涛专业为你提供各类网站程序、源码的定制、修改,网站相关技术的全程指导,欢迎与我取得联系,联系QQ:543098146,网址:www.mintao.net</div> </body> </html> |
具体示例请参照敏韬网右侧悬浮样式。 |