对联广告
2008-01-16 18:20
211 查看
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<script language="JavaScript">
var delta=0.3;
var collection;
var closeB=false;
var isScrolling = false;//2005-4-13
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;
var scrollTimeout;
document.body.onscroll = function(){
isScrolling = true;
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(function(){
isScrolling = false;
},200);
}
setInterval('play()',30);
}
}
function play()
{
if(isScrolling==true){//在拖动时不执行
return;
}
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();
//
url1='<a href=http://www.kekecn.com target=_blank><img src=attachments/month_0602/n200622313587.gif width=100 height=200 border=0></a><br><br><img src=attachments/month_0602/u2006223135813.gif onClick=closeBanner();>'
url2='<a href=http://www.kekecn.com target=_blank><img src=attachments/month_0602/n200622313587.gif width=100 height=200 border=0></a><br><br><img src=attachments/month_0602/u2006223135813.gif onClick=closeBanner();>'
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,''+url1+'');
theFloaters.addItem('followDiv2',6,80,''+url2+'');
theFloaters.play();
</script>
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>
<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>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<script language="JavaScript">
var delta=0.3;
var collection;
var closeB=false;
var isScrolling = false;//2005-4-13
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;
var scrollTimeout;
document.body.onscroll = function(){
isScrolling = true;
clearTimeout(scrollTimeout);
scrollTimeout = setTimeout(function(){
isScrolling = false;
},200);
}
setInterval('play()',30);
}
}
function play()
{
if(isScrolling==true){//在拖动时不执行
return;
}
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();
//
url1='<a href=http://www.kekecn.com target=_blank><img src=attachments/month_0602/n200622313587.gif width=100 height=200 border=0></a><br><br><img src=attachments/month_0602/u2006223135813.gif onClick=closeBanner();>'
url2='<a href=http://www.kekecn.com target=_blank><img src=attachments/month_0602/n200622313587.gif width=100 height=200 border=0></a><br><br><img src=attachments/month_0602/u2006223135813.gif onClick=closeBanner();>'
theFloaters.addItem('followDiv1','document.body.clientWidth-106',80,''+url1+'');
theFloaters.addItem('followDiv2',6,80,''+url2+'');
theFloaters.play();
</script>
<p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p><p>
<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>
</body>
</html>
相关文章推荐
- 符合W3C标准布局的js对联跟随广告
- 当对联广告遇到FLASH,显示在FALSH后时
- 对联浮动广告JS代码不滚动不浮动的解决方法
- 浮动对联广告---之左侧代码
- js 对联广告、漂浮广告封装类(IE,FF,Opera,Safari,Chrome
- javascript对联广告 兼容 IE FF
- 兼容w3c的对联广告
- js 对联广告
- 对联广告
- JavaScript网页特效---对联广告,网站对联广告
- 滚动的对联广告
- jquery 插件 轻量级jquery对联广告 优装网对联广告 jquery.couplet
- 网页JS弹出广告代码,头部,右下角,网页中漂浮,对联广告代码等大全
- [对联广告] JS脚本类
- 网页两边的对联广告代码
- flash对联广告代码: 两边显示 不移动 可关闭
- 对联广告 可关闭
- 不带关闭的对联广告
- 支持XHTML(符合Web标准)的对联广告代码
- ASP.NET 2.0的Master页中写入javascript浮动对联广告,不能浮动。