麻烦 LZ 把全部代码发出来,至少发一个能直接调用的只有 js ,都不知道怎么调用!!!

解决方案 »

  1.   

    可以凑合下
    function MoveRightLayer(layerName) { 
    //var x = 5;
    var x = document.body.scrollLeft + document.body.clientWidth - 160 +'px';
    var y = (document.body.clientHeight - 200)/2; 
    var diff = (document.body.scrollTop + y - document.all.AdLayer.style.posTop)*.40; 
    var y = document.body.scrollTop + y - diff; 
    eval("document.all." + layerName + ".style.posTop = y"); 
    eval("document.all." + layerName + ".style.left = x"); 
    setTimeout("MoveRightLayer('AdLayer');",20); 
      

  2.   

    window.onresize 
    window.onscroll 
      

  3.   


    //---------------------------------------------
      window.onresize=function(){
        var thisObj = document.getElementById("AdLayer");
        if (thisObj){
            thisObj.style.pixelLeft=document.body.offsetWidth-180;
            thisObj.style.pixelTop=(document.body.clientHeigh-200)/2;
            }
     }
    //---------------------------------------------
    function initEcAd() { 
    document.all.AdLayer.style.posTop = -200; 
    document.all.AdLayer.style.visibility = 'visible' 
    MoveRightLayer('AdLayer'); 

    function MoveRightLayer(layerName) { 
    var x = 5; 
    var y = (document.body.clientHeight - 200)/2; 
    var diff = (document.body.scrollTop + y - document.all.AdLayer.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('AdLayer');",20); 

    var hover='orange',normal='slategray';//color; 
    var index=1;//z-index; 
    //最小化; 
    function min(obj) 

        var win = obj.parentNode.parentNode; 
        var sha = win.nextSibling; 
        var tit = obj.parentNode; 
        var msg = tit.nextSibling; 
        var flg = msg.style.display=="none"; 
        if(flg) 
        { 
            win.style.height  = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2; 
            sha.style.height  = win.style.height; 
            msg.style.display = "block"; 
            obj.innerHTML = "0"; 
        } 
        else 
        { 
            win.style.height  = parseInt(tit.style.height) + 2*2; 
            sha.style.height  = win.style.height; 
            obj.innerHTML = "2"; 
            msg.style.display = "none"; 
        } 

    //关闭; 
    function cls(obj) 

        var win = obj.parentNode.parentNode; 
        var sha = win.nextSibling; 
        win.style.visibility = "hidden"; 
        sha.style.visibility = "hidden"; 
    } //创建一个对象; 
    function xWin(id,w,h,l,t,tit,msg) 

        index = index+2; 
        this.id      = id; 
        this.width  = w; 
        this.height  = h; 
        this.left    = l; 
        this.top    = t; 
        this.zIndex  = index; 
        this.title  = tit; 
        this.message = " <a href='#'>浏览过的页面 </a>"; 
        this.obj    = null; 
        this.bulid  = bulid; 
        this.bulid(); 
    } //初始化; 
    function bulid() 

        var str = "" 
            + " <div id=" + this.id + " " 
            + "style='" 
            + "z-index:" + this.zIndex + ";" 
            + "width:" + this.width + ";" 
            + "height:" + this.height + ";" 
            + "left:" + this.left + ";" 
            + "top:" + this.top + ";" 
            + "color:" + normal + ";" 
            + "font-size:10px;" 
            + "font-family:Verdana;" 
            + "position:absolute;" 
            + "cursor:default;" 
            + "border:2px solid " + normal + ";" 
            + "' " 
            + "onmousedown='getFocus(this)'>" 
                + " <div " 
                + "style='" 
                + "background-color:" + normal + ";" 
                + "width:" + (this.width-2*2) + ";" 
                + "height:20;" 
                + "color:white;" 
                + "' " 
                + "ondblclick='min(this.childNodes[1])'" 
                + ">" 
                    + " <span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='min(this)'>0 </span>" 
                    + " <span style='width:12;border-width:0px;color:white;font-family:webdings;' onclick='cls(this)'>r </span>" 
                + " </div>" 
                    + " <div style='" 
                    + "width:100%;" 
                    + "height:" + (this.height-20-4) + ";" 
                    + "line-height:14px;" 
                    + "word-break:break-all;" 
                    + "padding:3px;" 
                    + "'>" + this.message + " </div>" 
            + " </div>" 
            + " <div style='" 
            + "width:" + this.width + ";" 
            + "height:" + this.height + ";" 
            + "top:" + this.top + ";" 
            + "left:" + this.left + ";" 
            + "z-index:1;" 
            + "position:absolute;" 
            + "filter:alpha(opacity=40);" 
            + "'> </div>"; 
        document.body.insertAdjacentHTML("beforeEnd",str); 

    <!-- 
    function initialize() 

        var a = new xWin("AdLayer",160,200,document.body.clientWidth-160, (document.body.clientHeight-200)/2,""," <a href='#'>浏览过的页面 </a>"); 
        initEcAd(); 
    } window.onload = initialize; 
    //-->
      

  4.   

      window.onresize=function(){
        var thisObj = document.getElementById("AdLayer");
        if (thisObj){
            thisObj.style.pixelLeft=document.body.clientHeigh-160;
            thisObj.style.pixelTop=(document.body.clientHeigh-200)/2;
            }
     }在脚本里添加以上代码
      

  5.   

    刚才有一个属性写错了,呵呵
      window.onresize=function(){ 
        var thisObj = document.getElementById("AdLayer"); 
        if (thisObj){ 
            thisObj.style.pixelLeft=document.body.clientWidth-160; 
            thisObj.style.pixelTop=(document.body.clientHeigh-200)/2; 
            } 

     
      

  6.   

    http://country.lvyou168.cn/flashwariii/divHoldeBottomRight
      

  7.   

    汗已解决,原来是下面在初始化div的时候,限定了left和top,这俩块去掉就可以了。
      

  8.   

    楼主用 setTimeout("MoveRightLayer('AdLayer');",20); 每隔20毫秒记算一次这个方法实在不好,应在window.onresize事件里才开始使用settimeout,当移动到位置后应该销毁setTimeout.还有不是因为在div 里指字了top 和 left 才不能移动,而是因为没有用对属性。