在head区域里加入:
<script type="text/javascript" language="JavaScript">// <![CDATA[
function GoTop() {
window.scrollTo(0,0);
}
function GoTop_Call() {
document.body.ondblclick = Top;
}
var Xpos = 0;
var Ypos = 0;
var Ygravity = 0.85;
var scrollPos = 0;
var oldScrollPos = 0;
function FloatMenu() {
docWidth = document.body.clientWidth; // Update document width
docHeight = document.body.clientHeight; // Update document height
oldScrollPos = scrollPos;
scrollPos = document.body.scrollTop; // Update scrollbar position
Xpos = 743;
//Xpos = (docWidth - floater.offsetWidth) - 10;
//Xpos = (docWidth / 2) + 410; //
Yboundary = ((scrollPos + docHeight) - floater.offsetHeight) - 15; //
if (floater.offsetTop < Yboundary - 1) // Object is behind boundary Ypos += 2; if (floater.offsetTop > Yboundary + 1) // Object is past boundary
Ypos -= 1;
Ypos *= Ygravity; // Slow object down
floater.style.pixelLeft = Xpos;
floater.style.pixelTop += Ypos; // Make object bounce
}
window.setInterval("FloatMenu()", 1); /
// ]]></script>
在body区域里加入:
<div id="floater" style="z-index: 1; left: 743px; visibility: visible; width: 33px; position: absolute; top: 470px; height: 13px;"><a onfocus="this.blur()" href="javascript :GoTop();"><img src="_top.gif" alt="" width="36" height="18" border="0" /></a></div>