ShowHide改为
--------------------------------------
function ShowHide(id,dis){
var w = document.getElementById("xMsg"+id);
var w1 = w.nextSibling;var bdisplay = (dis==null)?((w.style.display=="")?"none":""):dis
w.style.display = bdisplay;
w1.style.display = bdisplay;w.style.left = (document.body.clientWidth-w.style.width.replace("px",""))/2;
w.style.top  = (document.body.clientHeight-w.style.height.replace("px",""))/2;

w1.style.left = parseInt(w.style.left) + offx;
w1.style.top = parseInt(w.style.top) + offy;}
//resize的时候也重定位就可以了

解决方案 »

  1.   

    function initialize()
    {
    var a = new xWin("1",160,200,200,200,"窗口1","xWin <br/> A Cool Pop Div Window<br/>Version:1.0<br/>2002-8-13");
    var b = new xWin("2",240,200,100,100,"窗口2","Welcome to visited my personal website:<br/><a href=http://www.youthfly.net target=_blank>http://www.youthfly.net</a><br/>anducanalsosignmyguestbookat:<br/><ahref=http://www ... youthfly.net</a><br/><br/>thx!!!=)..."); 
    var c = new xWin("3",750,700,140,10,"<center>个人简介</center>","Copyright by 网页一班!");
    ShowHide("1","none");
    ShowHide("2","none");
    ShowHide("3","none");//隐藏窗口1
    center('1');center('2');center('3');
    }
    window.onload = initialize;
    //-->
    function center(id)
    {
    xwin = document.getElementById("xMsg"+id);
    xwin.style.left = (document.body.clientWidth-xwin.style.width.replace("px",""))/2;
    xwin.style.top  = (document.body.clientHeight-xwin.style.height.replace("px",""))/2;

    xwinbg = document.getElementById("xMsg"+id+"bg");
    xwinbg.style.left = (document.body.clientWidth-xwinbg.style.width.replace("px",""))/2;
    xwinbg.style.top  = (document.body.clientHeight-xwinbg.style.height.replace("px",""))/2;
    }
    加个方法,然后在初始化里加3个调用
      

  2.   

    谢谢 leohuang(LEO) 大哥,虽然不能自适应但是能居中了~~