<html>
<head>
<title>对联广告代码</title>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</head>
<body>
<table><tr><td height="1000"></tr></td></table>
<script language="网页特效">
var delta=0.8;
var collection;
var closeb=false;
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()',30);
}
}
function play()
{
if(screen.width<=800 || closeb)
{
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 = '';
}
}
function closebanner()
{
closeb=true;
return;
}var thefloaters = new floaters();
thefloaters.additem('followdiv1','document.body.clientwidth-106',80,'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="97" height="233"><param name="movie" value="/jscss教程/demoimg/200908/ad-02.swf"><param name="quality" value="high"><embed src="/jscss/demoimg/200908/ad-02.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="97" height="233"></embed></object><br><br><img src="/jscss/demoimg/200908/close.gif" onclick="closebanner();">');
thefloaters.additem('followdiv2',6,80,'<img src="/jscss/demoimg/dl.jpg" width="97" height="233"><br><br><img src="/jscss/demoimg/200908/close.gif" onclick="closebanner();">');
thefloaters.play();
</script>
</p>
</body>
</html>
对联广告实例二
scroolad.js// javascript documentvar closebuttonhtml = '<div align="right" style="position: absolute;top:0px;right:0px;margin:2px;padding:2px;z-index:2000;"><a href="javascript:;" onclick="hidead()" style="color:red;text-decoration:none;font-size:12px;">关闭</a></div>'lastscrolly=0;function heartbeat(){ var diffy;if (document.documentelement && document.documentelement.scrolltop)diffy = document.documentelement.scrolltop;else if (document.body)diffy = document.body.scrolltopelse{/*netscape stuff*/}percent=.1*(diffy-lastscrolly); if(percent>0)percent=math.ceil(percent); else percent=math.floor(percent); document.getelementbyid("lovexin12").style.top=parseint(document.getelementbyid("lovexin12").style.top)+percent+"px";document.getelementbyid("lovexin14").style.top=parseint(document.getelementbyid("lovexin12").style.top)+percent+"px";lastscrolly=lastscrolly+percent; }suspendcode12="<div id="lovexin12" style='left:2px;position:absolute;top:120px;width:90px;height:230px;background-color:#ededed;border:1px solid #ddd;'>"+closebuttonhtml+"<img src="/images/bq100.gif"/></div>"suspendcode14="<div id="lovexin14" style='right:2px;position:absolute;top:120px;width:90px;height:230px;background-color:#ededed;border:1px solid #ddd;'>"+closebuttonhtml+"<img src="/images/bq100.gif"/></div>"document.write(suspendcode12); document.write(suspendcode14); window.setinterval("heartbeat()",1);function hidead(){ document.getelementbyid("lovexin12").style.display="none"; document.getelementbyid("lovexin14").style.display="none";}<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3c.org/tr/1999/rec-html401-19991224/loose.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=gb2312" /><title>标准对联广告js代码</title><style type="text/css"><!--html,body{height:1203px;}#mm{height:1000px;}--></style><script language="javascript" type="text/javascript" src="scroolad.js"></script></head><body><div id="mm"></div></body></html>