<script language=vbs> for i = 1 to 200 document.write ("<br>") next </script> <script language="JavaScript"> <!-- Written by Myhyli, 2003/07/21. myhyli.blueidea.com --> <!-- Member Of Blueidea Web Team. --> <!-- Welcome to www.blueidea.com. --> var delta=0.15 var collection; function floaters() { this.items = []; this.addItem = function(id,x,y,content) { document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var theFloaters = new floaters(); theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<a href=http://blueidea.com target=_blank><img src=http://www.blueidea.com/img/common/close.gif border=0></a><br><br>'); theFloaters.addItem('followDiv2',6,80,'<a href=http://blueidea.com target=_blank><img src=http://www.blueidea.com/img/common/close.gif border=0></a><br><br'); theFloaters.play(); </script>
http://bbs.blueidea.com/thread-1821912-1-1.html
我觉得就是 获得鼠标的当前纵坐标 然后将这个纵坐标值赋给 广告的div就可以了把
<!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=utf-8" /> <title>Untitled Document</title> <script language=vbs> for i = 1 to 200 document.write (" <br>") next </script> <script language="JavaScript"> <!-- Written by Myhyli, 2003/07/21. myhyli.blueidea.com --> <!-- Member Of Blueidea Web Team. --> <!-- Welcome to www.blueidea.com. --> var delta=0.15 var collection; function floaters() { this.items = []; this.addItem = function(id,x,y,content) { document.write(' <DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+' </DIV>');
var obj1=null;
var obj2=null;
var ts;
window.onload=Init;
function Init()
{
obj1=document.getElementById("div1");
obj1.style.left=parseInt(document.body.clientWidth)-parseInt(obj1.offsetWidth)+"px";//居右
obj1.style.top=0;
ts=setInterval(CheckPos,10); //控制位置函数
}
function CheckPos()
{
obj1.style.top=document.body.scrollTop+"px";
}
</script>
<body>
<div id="div1" style="position:absolute;width:100px;height:100px;border:solid 1px black;">
内容</div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<script>
//对联广告开始
var dlIndex=0;
var fLSrc = "_images/蔡依林.gif";
var fLHref = "http://cd.piao.com.cn/ticket_1494.html";
var fLTarget = "_blank";
var fLWidth = 80;
var fLHeight = 287;
var fRSrc = "_images/left/dsn.gif";
var fRHref = "#";
var fRTarget = "_blank";
var fRWidth = 80;
var fRHeight = 287;var fVAlign = 1;
var fMarginH = 200;
var fMarginW = 10;
function floatMove(){if(navigator.userAgent.indexOf("Firefox")>= 0||navigator.userAgent.indexOf("Opera")>=0){if(fLSrc!=""){if(fVAlign==1){document.getElementById("fLFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+((document.body.clientHeight>document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight)-fLHeight-fMarginH+'px';}else{document.getElementById("fLFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+fMarginH+'px';}document.getElementById("fLFloat").style.left=fMarginW+'px';}if(fRSrc!=""){if(fVAlign==1){document.getElementById("fRFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+((document.body.clientHeight>document.documentElement.clientHeight)?document.documentElement.clientHeight:document.body.clientHeight)-fRHeight-fMarginH+'px';}else{document.getElementById("fRFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+fMarginH+'px';}document.getElementById("fRFloat").style.left=((document.body.clientWidth>document.documentElement.clientWidth)?document.body.clientWidth:document.documentElement.clientWidth)-fRWidth-fMarginW+'px';}}else{if(fLSrc!=""){if(fVAlign==1){document.getElementById("fLFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+((document.documentElement.clientHeight==0)?document.body.clientHeight:document.documentElement.clientHeight)-fLHeight-fMarginH+'px';}else{document.getElementById("fLFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+fMarginH+'px';}document.getElementById("fLFloat").style.left=fMarginW+'px';}if(fRSrc!=""){if(fVAlign==1){document.getElementById("fRFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+((document.documentElement.clientHeight==0)?document.body.clientHeight:document.documentElement.clientHeight)-fRHeight-fMarginH+'px';}else{document.getElementById("fRFloat").style.top=(document.body.scrollTop?document.body.scrollTop:document.documentElement.scrollTop)+fMarginH+'px';}document.getElementById("fRFloat").style.left=((document.documentElement.clientWidth==0)?document.body.clientWidth:document.documentElement.clientWidth)-fRWidth-fMarginW+'px';}}setTimeout("floatMove();",100)}if(fLSrc!=""){document.write("<div id=\"fLFloat\" style=\"position: absolute;z-index:2;width:"+fLWidth+";\">");if(fLHref!=""){document.write("<a target=\""+fLTarget+"\" href=\""+fLHref+"\">");}document.write("<img src=\""+fLSrc+"\" width=\""+fLWidth+"\" height=\""+fLHeight+"\" border=\"0\" />");if(fLHref!=""){document.write("</a>");}document.write("</div>");}if (fRSrc!=""){document.write("<div id=\"fRFloat\" style=\"position: absolute;z-index:2;width:"+fRWidth+";\">");if(fRHref!=""){document.write("<a target=\""+fRTarget+"\" href=\""+fRHref+"\">");}document.write("<img src=\""+fRSrc+"\" width=\""+fLWidth+"\" height=\""+fRHeight+"\" border=\"0\" />");if(fLHref!=""){document.write("</a>");}document.write("</div>");}floatMove();var lpop=document.getElementById("fLFloat");
if(lpop!=null){
var a=document.createElement("A");
a.innerHTML="关闭";
a.href="javascript:void(0);"
a.onclick=new Function("this.parentNode.style.display='none';");
lpop.appendChild(a);
}
var rpop=document.getElementById("fRFloat");
if(rpop!=null){
var a1=document.createElement("A");
a1.innerHTML="关闭";
a1.href="javascript:void(0);"
a1.onclick=new Function("rpop.style.display='none';");
rpop.appendChild(a1);
}//对联广告结束
</script><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
曾经别人给我的代码
<SCRIPT LANGUAGE="JavaScript">
<!--
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 20);
}document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src=images/mxd.jpg></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><img src=images/freestyle.jpg></div>");
initEcAd()
//-->
</SCRIPT>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>我也贴一个!!
for i = 1 to 200
document.write ("<br>")
next
</script>
<script language="JavaScript">
<!-- Written by Myhyli, 2003/07/21. myhyli.blueidea.com -->
<!-- Member Of Blueidea Web Team. -->
<!-- Welcome to www.blueidea.com. -->
var delta=0.15
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i<collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i<collection.length;i++)
{
var followObj = collection[i].object;
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = '';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<a href=http://blueidea.com target=_blank><img src=http://www.blueidea.com/img/common/close.gif border=0></a><br><br>');
theFloaters.addItem('followDiv2',6,80,'<a href=http://blueidea.com target=_blank><img src=http://www.blueidea.com/img/common/close.gif border=0></a><br><br');
theFloaters.play();
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language=vbs>
for i = 1 to 200
document.write (" <br>")
next
</script>
<script language="JavaScript">
<!-- Written by Myhyli, 2003/07/21. myhyli.blueidea.com -->
<!-- Member Of Blueidea Web Team. -->
<!-- Welcome to www.blueidea.com. -->
var delta=0.15
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write(' <DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+' </DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y;
this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width <=800)
{
for(var i=0;i <collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i <collection.length;i++)
{
var followObj = collection[i].object;
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
}
if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = '';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,' <a href=http://blueidea.com target=_blank> <img src=http://www.blueidea.com/img/common/close.gif border=0> </a> <br> <br>');
theFloaters.addItem('followDiv2',6,80,' <a href=http://blueidea.com target=_blank> <img src=http://www.blueidea.com/img/common/close.gif border=0> </a> <br> <br');
theFloaters.play();
</script>
<style type="text/css">
<!--
#apDiv1 {
position:absolute;
width:200px;
height:115px;
z-index:1;
top: 31px;
left: 9px;
background-color: #000000;
}
#apDiv2 {
position:absolute;
width:200px;
height:115px;
z-index:2;
left: 782px;
top: 31px;
background-color: #000000;
}
-->
</style>
</head><body>
<div id="followDiv1"></div>
<div id="followDiv2"></div>
</body>
</html>我是这样写的啊,运行了网页不行啊?怎么不能向下移动呢?555
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
#AdLayer1{
position:absolute;
width:200px;
height:115px;
z-index:1;
top: 31px;
left: 9px;
background-color: #000000;
}
#AdLayer2{
position:absolute;
width:200px;
height:115px;
z-index:2;
left: 782px;
top: 31px;
background-color: #000000;
}
-->
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function initEcAd() {
document.all.AdLayer1.style.posTop = -200;
document.all.AdLayer1.style.visibility = 'visible'
document.all.AdLayer2.style.posTop = -200;
document.all.AdLayer2.style.visibility = 'visible'
MoveLeftLayer('AdLayer1');
MoveRightLayer('AdLayer2');
}
function MoveLeftLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer1.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = parseInt(y)");
eval("document.all." + layerName + ".style.posLeft = x");
setTimeout("MoveLeftLayer('AdLayer1');", 20);
}
function MoveRightLayer(layerName) {
var x = 5;
var y = 340;
var diff = (document.body.scrollTop + y - document.all.AdLayer2.style.posTop)*.40;
var y = document.body.scrollTop + y - diff;
eval("document.all." + layerName + ".style.posTop = y");
eval("document.all." + layerName + ".style.posRight = x");
setTimeout("MoveRightLayer('AdLayer2');", 20);
}document.write("<div id=AdLayer1 style='position: absolute;visibility:hidden;z-index:1'><img src=images/mxd.jpg></div>"
+"<div id=AdLayer2 style='position: absolute;visibility:hidden;z-index:1'><img src=images/freestyle.jpg></div>");
initEcAd()
//-->
</SCRIPT>
</head><body onload="initEcAd()">
<div id="AdLayer1"></div>
<div id="AdLayer2"></div>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
</body>
</html>
我这样也试过了。不行啊???
var collection;
function floaters() {
this.items = [];
this.addItem = function(id,x,y,content)
{
document.write('<DIV id='+id+' style="Z-INDEX: 10; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>');
var newItem = {};
newItem.object = document.getElementById(id);
newItem.x = x;
newItem.y = y; this.items[this.items.length] = newItem;
}
this.play = function()
{
collection = this.items
setInterval('play()',10);
}
}
function play()
{
if(screen.width<=800)
{
for(var i=0;i<collection.length;i++)
{
collection[i].object.style.display = 'none';
}
return;
}
for(var i=0;i<collection.length;i++)
{
var followObj = collection[i].object;
var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y); if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) {
var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta;
dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx));
followObj.style.left=followObj.offsetLeft+dx;
} if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) {
var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;
dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy));
followObj.style.top=followObj.offsetTop+dy;
}
followObj.style.display = '';
}
}
var theFloaters = new floaters();
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,'<a href=http://www.dns333.com/ target=_blank><img src=http://t3.baidu.com/it/u=2759836254,1680293180&gp=2.jpg border=0></a><br><br><a href=http://www.dns333.net/ target=_blank><img src=http://t0.baidu.com/it/u=3785541142,1713759099&gp=3.jpg border=0>');
theFloaters.addItem('followDiv2',6,80,'<a href=http://www.dns333.net/ target=_blank><img src=http://t3.baidu.com/it/u=2759836254,1680293180&gp=2.jpg border=0></a><br><br><a href=http://www.dns333.com/ target=_blank><img src=http://t0.baidu.com/it/u=3785541142,1713759099&gp=3.jpg border=0><br>');
theFloaters.play();</script>
<script language="javascript" type="text/javascript">
var divAdInitTop;
function initDivAd()
{
divAdInitTop = document.getElementById("apDiv2").style.pixelTop;
window.onscroll = moveDivAd;
}
function moveDivAd()
{
if(document.documentElement.scrollTop != 0){
document.getElementById("apDiv2").style.pixelTop = divAdInitTop + document.documentElement.scrollTop;
document.getElementById("apDiv2").style.backgroundImage="../images/DivTitleLogin.gif";
document.getElementById("apDivA1").style.pixelTop = divAdInitTop + document.documentElement.scrollTop;
document.getElementById("apDivA1").style.backgroundImage="../images/DivTitleLogin.gif";
}
else{
document.getElementById("apDiv2").style.pixelTop = divAdInitTop + document.body.scrollTop;
document.getElementById("apDiv2").style.backgroundImage="../images/DivTitleLogin.gif";
document.getElementById("apDivA1").style.pixelTop = divAdInitTop + document.body.scrollTop;
document.getElementById("apDivA1").style.backgroundImage="../images/DivTitleLogin.gif";
}
}
</javascript">
http://topic.csdn.net/u/20090707/09/853aa9ec-af9b-46f4-866c-89a23d58feb0.html?19392