javascirpt 实现右侧浮动条
javascirpt 实现右侧浮动条
浮动在右侧
- <!-- 告诉浏览器本网页符合XHTML1.0过渡型DOCTYPE -->
- <!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" lang="gb2312">
- <head>
- <title>网页设计师:关于我们</title>
- <!-- 定义语言编码 -->
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <meta http-equiv="Content-Language" content="gb2312" />
- <!-- 为搜索引擎准备的信息 -->
- <meta name="author" content="ajie@netease.com,阿捷" />
- <meta name="Copyright" content="www.w3cn.org,自由版权,任意转载" />
- <meta name="description" content="新网页设计师。web标准的教程站点,推动web标准在中国的应用" />
- <meta content="designing, with, web, standards, xhtml, css, graphic, design, layout, usability, accessibility, w3c, w3, w3cn, ajie,web标准" name="keywords" />
- <!-- 浏览器收藏夹小图标 -->
- <link rel="icon" href="/favicon.ico" type="image/x-icon" />
- <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
- <!-- 双表法调用样式表 -->
- </head>
- <body>
- <div style="height:2000px;">
- <div id=divMenu style="Z-INDEX: 1; right:1px; WIDTH: auto; POSITION: absolute; TOP: 84px; HEIGHT: auto; background-color:
- #330033; layer-background-color: #330033; border: 1px none #000000;"><A href="tencent://Message/?Uin=292842755"><IMG alt=点击这里给我发消息
- src="http://wpa.qq.com/pa?p=1:292842755:10" border=0></A></div>
- <script language=JavaScript>
- var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
- var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");
- function CheckUIElements(){
- var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;
- if ( bNetscape4plus ) {
- yMenuFrom = document["divMenu"].top;
- yMenuTo = top.pageYOffset + 295;
- }
- else if ( bExplorer4plus ) {
- yMenuFrom = parseInt (divMenu.style.top, 10);
- yMenuTo = document.body.scrollTop + 135; //距页面顶部的距离
- }
- timeoutNextCheck = 500;
- if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
- setTimeout ("CheckUIElements()", timeoutNextCheck);
- return;
- }
- if ( yButtonFrom != yButtonTo ) {
- yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
- if ( yButtonTo < yButtonFrom )
- yOffset = -yOffset;
- if ( bNetscape4plus )
- document["divLinkButton"].top += yOffset;
- else if ( bExplorer4plus )
- divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;
- timeoutNextCheck = 10;
- }
- if ( yMenuFrom != yMenuTo ) {
- yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
- if ( yMenuTo < yMenuFrom )
- yOffset = -yOffset;
- if ( bNetscape4plus )
- document["divMenu"].top += yOffset;
- else if ( bExplorer4plus )
- divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;
- timeoutNextCheck = 10;
- }
- setTimeout ("CheckUIElements()", timeoutNextCheck);
- }
- function OnLoad()
- {
- var y;
- if ( top.frames.length )
- if ( bNetscape4plus ) {
- document["divMenu"].top = top.pageYOffset + 135;
- document["divMenu"].visibility = "visible";
- }
- else if ( bExplorer4plus ) {
- divMenu.style.top = document.body.scrollTop + 235;
- divMenu.style.visibility = "visible";
- }
- CheckUIElements();
- return true;
- }
- OnLoad();
- </script>
- </div>
- </body>
- </html>