提供一个参考。这个代码我有部分看不太明白,所以没改成。请高手指点哈。
*它将document.getElementById("AdRM_iframe")定义到了左上。//浮动广告
var Rimifon = {
"Ads" : new Object,
"NewFloatAd" : function(imgUrl, strLink)
{
//var ad = document.createElement("a");
var ad = document.getElementById("AdRM_iframe")
ad.id="asdf";
ad.DirV = true;
ad.DirH = true;
ad.AutoMove = true;
ad.Image = new Image;
ad.Seed = Math.random();
ad.Timer = setInterval("Rimifon.Float(" + ad.Seed + ")", 50);
this.Ads[ad.Seed] = ad;
ad.Image.Parent = ad;
ad.style.position = "absolute";
ad.style.left = 0;
ad.style.top = 0;
ad.Image.src = imgUrl;
ad.Image.onmouseover = function(){this.Parent.AutoMove = false;}
ad.Image.onmouseout = function(){this.Parent.AutoMove = true;}

if(strLink)
{
//ad.href = strLink;
ad.Image.border = 0;
//ad.target = "_blank";
}
//ad.appendChild(ad.Image);
//document.getElementById("form1").appendChild(ad);
//document.body.appendChild(ad);
//alert(document.body.innerHTML);
return ad;
},
"Float" : function(floatId)
{
var ad = this.Ads[floatId];
if(ad.AutoMove)
{
var curLeft = parseInt(ad.style.left);
var curTop = parseInt(ad.style.top);
if(ad.offsetWidth + curLeft > document.body.clientWidth + document.body.scrollLeft - 1)
{
curLeft = document.body.scrollLeft + document.body.clientWidth - ad.offsetWidth;
ad.DirH = false;
}
if(ad.offsetHeight + curTop > document.body.clientHeight + document.body.scrollTop - 1)
{
curTop = document.body.scrollTop + document.body.clientHeight - ad.offsetHeight;
ad.DirV = false;
}
if(curLeft < document.body.scrollLeft)
{
curLeft = document.body.scrollLeft;
ad.DirH = true;
}
if(curTop < document.body.scrollTop)
{
curTop = document.body.scrollTop;
ad.DirV = true;
}
ad.style.left = curLeft + (ad.DirH ? 1 : -1) + "px";
ad.style.top = curTop + (ad.DirV ? 1 : -1) + "px";
}
}
}
Rimifon.NewFloatAd("","");

解决方案 »

  1.   

    var Rimifon = {
    "Ads" : new Object,
    "NewFloatAd" : function(imgUrl, strLink)
    {

    var ad = document.getElementById("AdRM_iframe")
    ad.id="asdf";
    ad.DirV = true;
    ad.DirH = true;
    ad.AutoMove = true;
    ad.Image = new Image;
    ad.Seed = Math.random();
    this.Ads[ad.Seed] = ad;
    ad.Image.Parent = ad;
    ad.style.position = "absolute";
    ad.style.left = 0;
    ad.style.top = 0; return ad;
    },
    "Float" : function(floatId)
    { }
    }
    Rimifon.NewFloatAd("","");这个你试试 放在左上角
      

  2.   

    哦。明白了。是我搞错了。
    ad.style.position = "absolute"; 
    没注意看到这个