Chinaunix首页 | 论坛 | 博客
  • 博客访问: 415410
  • 博文数量: 112
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 905
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-05 21:14
文章分类

全部博文(112)

文章存档

2009年(3)

2008年(24)

2007年(55)

2006年(30)

我的朋友

分类: Java

2008-07-24 10:12:44

第一个对联广告,,
 
 
 
第二对联广告
 
        var vbWidth = 89;
        var vbHeight = 454;
        var vbSrc1 = 'http://topic.csdn.net/ui/images/logo_csdn.gif;
        var vbSrc2 = 'http://topic.csdn.net/ui/images/logo_csdn.gif';
        var vbUrl1 = '#;
        var vbUrl2 = '#';
 
 
var delta = 0.15
var collection;
function floaters() {
    this.items = [];
 var intervalId;
    this.addItem = function(id, x, y, content)
    {
        document.write('
' + content + '
');
        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
        intervalId = setInterval('play()', 10);
    }
 this.close = function()
 {
  clearInterval(intervalId);
  for (var i = 0; i < this.items.length; i++)
        {
            this.items[i].object.style.display = 'none';
        }
 }
}
function play()
{
    if (screen.width <= 800 || document.documentElement.clientWidth <= 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);
       
        followObj.style.left = document.documentElement.scrollLeft + followObj_x;
        /*
        if (followObj.offsetLeft != (document.documentElement.scrollLeft + followObj_x)) {
            var dx = (document.documentElement.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.documentElement.scrollTop + followObj_y)) {
            var dy = (document.documentElement.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 closeFoloaters()
{
 theFloaters.close();
}
var theFloaters = new floaters();
theFloaters.addItem('vb1', 'document.documentElement.clientWidth-90', 88, '');
theFloaters.addItem('vb2', 0, 88, '');
theFloaters.play();
阅读(750) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~