悬浮窗口随滚动条的变化改变

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<LINK
href="dip.css" type=text/css rel=stylesheet>
<style type="text/css">
<!--
a:link {
 color: #000000;
 text-decoration: none;
}
a:visited {
 text-decoration: none;
 color: #000000;
}
a:hover {
 text-decoration: underline;
 color: #FF0000;
}
a:active {
 text-decoration: none;
}
a.link9:link {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 9pt;
 color: #FF3333;
 text-decoration:underline;
}
a.link9:visited {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 9pt;
 color: #FF3333;
 text-decoration:underline;
}
a.link9:hover {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 9pt;
 color: #0000FF;
 text-decoration:underline;
}
a {
 font-size: 9pt;
}
body,td,th {
 font-size: 9pt;
}
.STYLE4 {color: #000000}
.STYLE5 {color: #0066CC}
-->
</style>
</head>

<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<DIV id=STATICMENU
            style="Z-INDEX: 999; LEFT: 880px; VISIBILITY: visible; WIDTH: 76px; POSITION: absolute; TOP: 274px; HEIGHT: 203px">
  <table width="100" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3"><img src="images/QQ_3.gif" width="106" height="71" border="0" usemap="#Map" onClick="closead();" ></td>
    </tr>
    <tr>
      <td width="4" height="78" background="images/QQ_8.gif"></td>
      <td width="98" align="center"><table width="100%" cellspacing="0" cellpadding="3">
        <tr>
          <td width="36%"><div align="center"><img src="images/QQ.gif" width="16" height="17"></div></td>
          <td width="64%"><a href="http://wpa.qq.com/msgrd?V=1&Uin=123456&Site=www.rrf.com.cn &Menu=no" target="_blank">业务咨询</a></td>
        </tr>
        <tr>
          <td><div align="center"><img src="images/QQ.gif" width="16" height="17"></div></td>
          <td><a href="http://wpa.qq.com/msgrd?V=1&Uin=123456&Site=www.rrf.com.cn &Menu=no" target="_blank">业务咨询</a></td>
        </tr>
        <tr>
          <td><div align="center"><img src="images/QQ.gif" width="16" height="17"></div></td>
          <td><a href="http://wpa.qq.com/msgrd?V=1&Uin=123456&Site=www.rrf.com.cn &Menu=no" target="_blank">技术服务</a></td>
        </tr>
        <tr>
          <td><div align="center"><img src="images/QQ.gif" width="16" height="17"></div></td>
          <td><a href="http://wpa.qq.com/msgrd?V=1&Uin=123456&Site=www.rrf.com.cn &Menu=no" target="_blank">意见反馈</a></td>
        </tr>
      </table></td>
      <td width="4" background="images/QQ_7.gif"></td>
    </tr>
    <tr>
      <td colspan="3"><img src="images/QQ_12.gif" width="106" height="44"></td>
    </tr>
  </table>
  <SCRIPT language=javascript>
<!--
var stmnGAP1 = 70;
var stmnGAP2 = 325;
var stmnBASE = 70;
var stmnActivateSpeed = 200;
var stmnScrollSpeed = 10;

var stmnTimer;

function RefreshStaticMenu()
{
 //alert(STATICMENU.offsetTop);
var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;
stmnStartPoint = parseInt(STATICMENU.style.top, 10);
stmnEndPoint = document.body.scrollTop + stmnGAP2;
if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

stmnRefreshTimer = stmnActivateSpeed;
if ( stmnStartPoint != stmnEndPoint ) {
                stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
                STATICMENU.style.top = parseInt(STATICMENU.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
                stmnRefreshTimer = stmnScrollSpeed;
}

stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

                STATICMENU.style.top = document.body.scrollTop + stmnBASE;
                RefreshStaticMenu();


function closead()
    {
 var div=document.getElementById("STATICMENU");
div.style.display="none";
    }
     
//-->
      </SCRIPT>
</DIV>
<table width="778" height="1500" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><p> </p>
      <p align="center"> 
    <iframe src="http://www.7stk.com/" width="1026" height="916" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="265" target="_blank"></iframe>   
      </p>
      </td>
  </tr>
</table>


</BODY></HTML>

 

 

 

注意:如果文件 加了<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

方法1、则要将document.body.scrollTop改成document.documentElement.scrollTop;

否则文件会一直以网页的最开头为基准,则悬浮框不会往下动。

缺点:火狐可以 360等不可以

方法2、直接将<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">删除

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值