网页漂浮 在线客服

javascript

2011-12-14 14:23

<html>
<head>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<title>网页右侧漂浮的QQ客服 title>
</head>
<body>

<style type="text/css">
#divStay_0419 {z-index:999;}
#www_0419 { z-index:2000;}
</style>
<DIV id="divStay_0419" style="POSITION: absolute;">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
  <TR>
    <TD vAlign="top" width="7%"> </TD>
  </TR>
</TABLE>
</DIV>

<div id="www_0419" style="POSITION: absolute; background-color:#FFF">
 <table cellspacing="0" cellpadding="0" width="109" border="0">
  <tr>
   <td colspan="3">
   <a onClick="CloseQQ_0419()" href="javascript:;" shape="circle" coords="91,16,12">
   <img height="34" src="http://0419.cn/plus/images/qq_top.gif" width="109" usemap="#Map" border="0"></a></td>
  </tr>
  <tr>
   <td width="6"><img height="70" src="http://0419.cn/plus/images/qq_life.gif" width="6"></td>
   <td valign="middle" width="96" background="http://0419.cn/plus/images/qq_bg.gif">
   <table cellspacing="0" cellpadding="0" width="90" align="center" border="0">
  
    <tr>
     <td>
     <table border="0" width="100%" cellpadding="2" id="table47">
      <tr>
       <td width="15" valign="top" height="23">
       <img border="0" src="http://0419.cn/plus/images/qq_v01.gif" width="16" height="16"></td>
       <td valign="bottom"><script>document.write("<a target=blank href=tencent://message/?uin=1313001&Site=辽阳网商城&Menu=yes style=font-size:9pt>QQ交谈</a>");</script></td>
      </tr>
     </table>
     </td>
    </tr>
    <tr>
     <td></td>
    </tr>
    <tr>
     <td>
     <table border="0" width="100%" cellpadding="2" id="table47">
      <tr>
       <td width="15" valign="top" height="23">
       <img border="0" src="http://0419.cn/plus/images/qq_v01.gif" width="16" height="16"></td>
       <td valign="bottom"><script>document.write("<a target=blank href=tencent://message/?uin=1313001&Site=辽阳网商城&Menu=yes style=font-size:9pt>QQ交谈</a>");</script></td>
      </tr>
     </table>
     </td>
    </tr>
    <tr>
     <td></td>
    </tr>
   </table>
   </td>
   <td width="7"><img height="70" src="http://0419.cn/plus/images/qq_right.gif" width="7"></td>
  </tr>

  <tr>
   <td colspan="3">
   <img height="33" src="http://0419.cn/plus/images/qq_logo.gif" width="109"></td>
  </tr>
 </table>
</div>
<script type="text/javascript">
function CloseQQ_0419()
{
www_0419.style.display="none";
return true;
}


function FloatTop_0419()
{
 var startX1_0419 =document.body.offsetWidth-125 ,startY1_1 = 5;
 var startX2_0419 =0,startY2_2 = 95;
 var ns_k = (navigator.appName.indexOf("Netscape") != -1);
 var d_000 = document;
 function ml_0419(id,startX,startY)
 {
  var el_1=d_000.getElementById?d_000.getElementById(id):d_000.all?d_000.all[id]:d_000.layers[id];
  if(d_000.layers)el_1.style=el_1;
  el_1.sP=function(x,y){this.style.left=x;this.style.top=y;};
  el_1.x = startX;
  el_1.y = startY;
  return el_1;
 }
 window.stayTopLeft_0419=function()
 {
 // var pY = ns_k ? pageYOffset : document.documentElement.scrollTop;
 var pY = ns_k ? pageYOffset : document.body.scrollTop;

代码我网站复制的  // 我艹你大爷的 我该了半天 才百度明白

页面具有DTD 用 document.documentElement

页面没有 DTD 用   document.body

//  var pY =  windows.pageYOffset ||document.documentElement|| document.body.scrollTop  ||  0;  //兼容写法  真邪恶


  ftlObj.y += (pY + startY1_1 - ftlObj.y)/2;
  ftlObj1.y += (pY + startY2_2 - ftlObj1.y)/2;
  ftlObj.sP(document.body.scrollLeft+document.body.offsetWidth-125, ftlObj.y);
  ftlObj1.sP(ftlObj1.x, ftlObj1.y);
 
  setTimeout("stayTopLeft_0419()", 30);
 }
//  ftlObj = ml_0419("divStay_0419",document.body.scrollLeft+document.body.offsetWidth-125,0);
//  ftlObj1 = ml_0419("www_0419",0,30);
 ftlObj = ml_0419("divStay_0419",(document.body.scrollLeft+document.body.offsetWidth)/2+379,0);
 ftlObj1 = ml_0419("www_0419",(document.body.scrollLeft+document.body.offsetWidth)/2+379,30);
 stayTopLeft_0419();
}
FloatTop_0419();
</script>

<span  style="height:2000px; width:50px; background-color:#F00;"/>asd</span>


</body>
</html>