在BODY内加入以下代码:
"< DIV id=floater1 style="Z-INDEX: 100; LEFT: 10px; VISIBILITY: visible; WIDTH: 100px; POSITION: absolute; TOP: 160px; height: 100px;" >
左邊的東西,可以是圖片,表格
< /DIV >
< DIV id=floater style="Z-INDEX: 100; RIGHT: 10px; VISIBILITY: visible; WIDTH: 100px; POSITION: absolute; TOP: 160px; left: 890px;" >
右邊的東西,可以是圖片,表格
< /DIV >"
menus.js的代码如下:
self.onError = null;
currentX = currentY = 0;
whichIt = null;
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
function heartBeat(objectid) {
if(IE) { diffY = document.body.scrollTop; diffX = document.body.scrollLeft; }
if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
if(diffY != lastScrollY) {
percent = .1 * (diffY - lastScrollY);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) {
objectid = objectid.split(";");
for (i = 0; i < objectid.length; i++) eval("document.all."+objectid[i]).style.pixelTop += percent;
}
if(NS) {
objectid = objectid.split(";");
for (i = 0; i < objectid.length; i++) eval("document."+objectid[i]).top += percent;
}
lastScrollY = lastScrollY + percent;
}
if(diffX != lastScrollX) {
percent = .1 * (diffX - lastScrollX);
if(percent > 0) percent = Math.ceil(percent);
else percent = Math.floor(percent);
if(IE) {
objectid = objectid.split(";");
for (i = 0; i < objectid.length; i++) eval("document.all."+objectid[i]).style.pixelLeft += percent;
}
if(NS) {
objectid = objectid.split(";");
for (i = 0; i < objectid.length; i++) eval("document."+objectid[i]).left += percent;
}
lastScrollX = lastScrollX + percent;
}
}
if(NS || IE) action = window.setInterval("heartBeat(’floater;floater1’)", 2); OK,成功就这么简单!DIV内的文字可以换成图片和表格,ID不改就行了...
另外,记得以上代码为了不干扰本文章的显示,在"<>"中多加了空格,拷贝到文档以后记得修改.
除了上述方法之外,还另从其他网站搜集到另一种实现方法,方法如下:
在显示页面中加入:
< SCRIPT language="JavaScript" src="js/flr.js" >< /SCRIPT >
< SCRIPT language="JavaScript" src="js/fll.js" >< /SCRIPT > ---------------------------flr.js------------------------------------
var imgheight
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=100:imgheight=120
function myload()
{
if (navigator.appName == "Netscape")
{document.dangdang.pageY=pageYOffset+window.innerHeight-imgheight-0;
document.dangdang.pageX=+window.innerWidth-107;
mymove();
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-0;
dangdang.style.left=document.body.offsetWidth-107;
mymove();
}
}
function mymove()
{
if(document.ns)
{
document.dangdang.top=pageYOffset+window.innerHeight-imgheight-0;
document.dangdang.left=pageXOffset+window.innerWidth-107;
setTimeout("mymove();",50)
}
else
{
dangdang.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight-0;
dangdang.style.left=document.body.scrollLeft+document.body.offsetWidth-107;
setTimeout("mymove();",50)
}
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true)
if (navigator.appName == "Netscape")
{
document.write("href=#’> src=’*.GIF’ width=’80’ height=’80’>");
myload()}
else
{
document.write("
");
myload()
} -------------------------fll.js--------------------------------------
var imgheight
var imgleft
document.ns = navigator.appName == "Netscape"
window.screen.width>800 ? imgheight=110:imgheight=110
window.screen.width>800 ? imgleft=5:imgleft=5
function myload()
{
if (navigator.appName == "Netscape")
{document.myleft.pageY=pageYOffset+window.innerHeight-imgheight;
document.myleft.pageX=imgleft;
leftmove();
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
leftmove();
}
}
function leftmove()
{
if(document.ns)
{
document.myleft.top=pageYOffset+window.innerHeight-imgheight
documen
t.myleft.left=imgleft;
setTimeout("leftmove();",80)
}
else
{
myleft.style.top=document.body.scrollTop+document.body.offsetHeight-imgheight;
myleft.style.left=imgleft;
setTimeout("leftmove();",80)
}
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true)
if (navigator.appName == "Netscape")
{
document.write("href=’http://www.polocars.com/'>width=’80’ height=’80’>");
myload()}
else
{
document.write("
");
myload()
}