|
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<LINK
href="dip.css" type=text/css rel=stylesheet>
</head>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id=divMenu style="Z-INDEX: 1; LEFT:883px; WIDTH: 75px; POSITION: absolute; TOP: 84px; HEIGHT: 383px; border: solid 1px #330033;"></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.documentElement.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.documentElement.scrollTop + 235;
divMenu.style.visibility = "visible";
}
CheckUIElements();
return true;
}
OnLoad();
</script>
<table width="996" border="0" cellspacing="0" cellpadding="0" height="5000">
<tr>
<td> </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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<LINK
href="dip.css" type=text/css rel=stylesheet>
</head>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<script>
function initEcAd(s_right,r_top) {
document.all.AdLayer2.style.visibility = 'visible'
MoveRightLayer('AdLayer2',s_right,r_top);
}
function MoveRightLayer(layerName,s_right,r_top) {
right_x = s_right;
right_y1 = r_top
right_y2 = r_top;
var diff = (document.documentElement .scrollTop + right_y1 - document.all.AdLayer2.style.posTop)*.40;
var right_y1 = document.documentElement .scrollTop + right_y1 - diff;
eval("document.all." + layerName + ".style.posTop = "+right_y1);
eval("document.all." + layerName + ".style.posRight = "+right_x);
setTimeout("MoveRightLayer('AdLayer2',right_x,right_y2);", 10);
}
</script>
<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'>
<table border='0' width='60' cellspacing='0' cellpadding='0'>
<tr><td width='100%'>sdfsdfsdfsfdsdf
</td></tr>
</table>
</div>
<script>initEcAd(5,150)</script>
<div style="height:2000px;"></div>
</BODY></HTML>
|