代码没办法调试
xWin上面的代码中没定义

解决方案 »

  1.   

    <script type="text/javascript" src="x.js"></script>
    仔细看代码内容,有这句:要另外建x.js文件~!<!--
    //可以打包为js文件;…………………………
    ………………document.body.insertAdjacentHTML("beforeEnd",str);
    }
    //-->
      

  2.   

    初步看了一下代码
    改起来比较麻烦,他的最小化和关闭都是在一个div上的,如果改了宽度,自然全部都变形了,除非要缩小的改到title的字符长度,还有就是适应宽度,最大化之后又得修改回来,麻烦的事情...虽然不难,但是麻烦呀,楼主你自己改改吧在min函数里改改
      

  3.   

    是啊,代码比较麻烦
    给楼主一个思路吧,在开始的时候定义一个全局二维数组变量,在win的构造函数中把id和其他属性push进去,并且定义个新属性,就是最小化的innerHTML,大体上就是那三个span.然后在min函数中执行flag的两个分支分别进行判断, 查找全局的那个数组通过"msgx"+id来匹配
    对style.width和innerHTML进行替换。
      

  4.   

    我运行成功了,不错的代码<!-- Welcome To http://www.socut.com -->
    <html>
    <head>
    <style type='text/css'>
    <!--
    a:visited{text-decoration:none;color:slategray;}
    a:hover{text-decoration:underline;color:slategray;}
    a:link{text-decoration:none;color:slategray;}
    -->
    </style><script>
    <!--
    //可以打包为js文件;
    var x0=0,y0=0,x1=0,y1=0;
    var offx=6,offy=6;
    var moveable=false;
    var hover='orange',normal='slategray';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
    var sha = win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = hover;
    win.style.borderColor = hover;
    obj.nextSibling.style.color = hover;
    sha.style.left = x1 + offx;
    sha.style.top = y1 + offy;
    moveable = true;
    }
    //拖动;
    function drag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    if(moveable)
    {
     win.style.left = x1 + event.clientX - x0;
     win.style.top = y1 + event.clientY - y0;
     sha.style.left = parseInt(win.style.left) + offx;
     sha.style.top = parseInt(win.style.top) + offy;
    }
    }
    //停止拖动;
    function stopDrag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    win.style.borderColor = normal;
    obj.style.backgroundColor = normal;
    obj.nextSibling.style.color = normal;
    sha.style.left = obj.parentNode.style.left;
    sha.style.top = obj.parentNode.style.top;
    //放开标题栏;
    obj.releaseCapture();
    moveable = false;
    }
    //获得焦点;
    function getFocus(obj)
    {
    index = index + 2;
    var idx = index;
    obj.style.zIndex=idx;
    obj.nextSibling.style.zIndex=idx-1;
    }
    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 = msg;
    this.obj   = null;
    this.bulid  = bulid;
    this.bulid();
    }
    //初始化;
    function bulid()
    {
    var str = ""
     + "<div id=xMsg" + this.id + " "
     + "style='"
     + "z-index:" + this.zIndex + ";"
     + "width:" + this.width + ";"
     + "height:" + this.height + ";"
     + "left:" + this.left + ";"
     + "top:" + this.top + ";"
     + "background-color:" + normal + ";"
     + "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;"
      + "' "
      + "onmousedown='startDrag(this)' "
      + "onmouseup='stopDrag(this)' "
      + "onmousemove='drag(this)' "
      + ">"
      + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;'>" + this.title + "</span>"
      + "<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) + ";"
      + "background-color:white;"
      + "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:" + (this.zIndex-1) + ";"
     + "position:absolute;"
     + "background-color:black;"
     + "filter:alpha(opacity=40);"
     + "'>?</div>";
     //alert(str);
    document.body.insertAdjacentHTML("beforeEnd",str);
    }
    -->
    </script><script language='JScript'>
    <!--
    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,"欢迎","欢迎访问:<br><a href=http://dn-home.ik8.com target=_blank>我的网页http://dn-home.ik8.com</a><br>:) <br>");
    var c = new xWin("3",200,160,750,50,"窗口标题3","内容部分");
    }
    window.onload = initialize;
    //-->
    </script>
    <title>_xWin</title>
    </head>
    <body onselectstart='return false' oncontextmenu='return false'>
    </body>
    </html>
      

  5.   

    至于修改上,感觉hbhbhbhbhb1021说得不错,但觉得还有一个地方没说到,就是标题文字长度与100PX之间的关系:
      当标题文字长度超出100PX时,必须进行裁剪了。这就又涉及标题文字字号与像素换算的关系。如果设置文字字号用PX单位就比较好算了,比如设为12PX,可以算出100PX只能显示8个汉字,还得减去标题栏里其它部分所占的宽度,也就只能显示5个汉字了,其中还得有个“…”号。
      

  6.   

    修改非常简单,你只要弄清楚他的“窗口”是如何生成的就可以。代码结构很清晰,不是什么“苦力活”。
    先议论几句:
    1、这个代码有些年头了,4年前我就见过。他基本上还是沿用html方法,而不是dhtml方法
    2、由于历史的原因,这个代码只能应用于ie。不过那时网景倒台火狐尚未出生,由如何兼容呢
    3、要做到浏览器兼容,需要修改大部代码,有点得不偿失修改方法:
    1、缩小时标题宽度变成100px
    将函数min改为
    function min(obj)
    {
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling;
    var tit = obj.parentNode;
    var msg = tit.nextSibling;
    var p = tit.firstChild; //取的标题所在的spanvar flg = msg.style.display=="none";
    if(flg)
    {
     win.style.width = win.st;//设置窗口宽度
     sha.style.width = win.st;//设置阴影宽度
     tit.style.width = win.st - 2*2;//设置标题栏宽度
     p.style.width = win.st - 2*12-4;//设置标题宽度 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.st = parseInt(win.style.width);//缓存窗口定义宽度
     win.style.width = 100;//设置窗口宽度
     sha.style.width = 100;//设置阴影宽度
     tit.style.width = 100 - 2*2;//设置标题栏宽度
     p.style.width = 100 - 2*12-4;//设置标题宽度 win.style.height = parseInt(tit.style.height) + 2*2;
     sha.style.height = win.style.height;
     obj.innerHTML = "2";
     msg.style.display = "none";
    }
    }
    加注的就是新增代码2、处理因宽度改变而不能容纳标题的问题(其实这个问题是原代码的bug,因为定义窗口时就有标题超长的问题)
    修改
    "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;'>" + this.title

    "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;height:100%;overflow:hidden;'><nobr>" + this.title +"</nobr>"即指定标题内容显示区域的高度和溢出时的处理方式
      

  7.   

    完整的代码
    <!--
    //可以打包为js文件;
    var x0=0,y0=0,x1=0,y1=0;
    var offx=6,offy=6;
    var moveable=false;
    var hover='orange',normal='slategray';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
    var sha = win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = hover;
    win.style.borderColor = hover;
    obj.nextSibling.style.color = hover;
    sha.style.left = x1 + offx;
    sha.style.top = y1 + offy;
    moveable = true;
    }
    //拖动;
    function drag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    if(moveable)
    {
     win.style.left = x1 + event.clientX - x0;
     win.style.top = y1 + event.clientY - y0;
     sha.style.left = parseInt(win.style.left) + offx;
     sha.style.top = parseInt(win.style.top) + offy;
    }
    }
    //停止拖动;
    function stopDrag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    win.style.borderColor = normal;
    obj.style.backgroundColor = normal;
    obj.nextSibling.style.color = normal;
    sha.style.left = obj.parentNode.style.left;
    sha.style.top = obj.parentNode.style.top;
    //放开标题栏;
    obj.releaseCapture();
    moveable = false;
    }
    //获得焦点;
    function getFocus(obj)
    {
    index = index + 2;
    var idx = index;
    obj.style.zIndex=idx;
    obj.nextSibling.style.zIndex=idx-1;
    }
    function min(obj)
    {
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling;
    var tit = obj.parentNode;
    var msg = tit.nextSibling;
    var p = tit.firstChild; //取的标题所在的spanvar flg = msg.style.display=="none";
    if(flg)
    {
     win.style.width = win.st;//设置窗口宽度
     sha.style.width = win.st;//设置阴影宽度
     tit.style.width = win.st - 2*2;//设置标题栏宽度
     p.style.width = win.st - 2*12-4;//设置标题宽度 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.st = parseInt(win.style.width);//缓存窗口定义宽度
     win.style.width = 100;//设置窗口宽度
     sha.style.width = 100;//设置阴影宽度
     tit.style.width = 100 - 2*2;//设置标题栏宽度
     p.style.width = 100 - 2*12-4;//设置标题宽度 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 = msg;
    this.obj   = null;
    this.bulid  = bulid;
    this.bulid();
    }
    //初始化;
    function bulid()
    {
    var str = ""
     + "<div id=xMsg" + this.id + " "
     + "style='"
     + "z-index:" + this.zIndex + ";"
     + "width:" + this.width + ";"
     + "height:" + this.height + ";"
     + "left:" + this.left + ";"
     + "top:" + this.top + ";"
     + "background-color:" + normal + ";"
     + "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;"
      + "' "
      + "onmousedown='startDrag(this)' "
      + "onmouseup='stopDrag(this)' "
      + "onmousemove='drag(this)' "
      + ">"
      + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;height:100%;overflow:hidden;'><nobr>" + this.title + "</nobr></span>"
      + "<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) + ";"
      + "background-color:white;"
      + "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:" + (this.zIndex-1) + ";"
     + "position:absolute;"
     + "background-color:black;"
     + "filter:alpha(opacity=40);"
     + "'>?</div>";
     //alert(str);
    document.body.insertAdjacentHTML("beforeEnd",str);
    }
    //-->
      

  8.   

    xuzuning(唠叨) 确实是个高人,代码测试成功了!
    但是,我发现了一个美中不足的地方:即标题栏没有原来的美观,文字跟放大,缩小,关闭等三个图标不在同一水平线上?
    不知你有无发现?
      

  9.   

    调整下高度就可以了
    <!--
    //可以打包为js文件;
    var x0=0,y0=0,x1=0,y1=0;
    var offx=6,offy=6;
    var moveable=false;
    var hover='orange',normal='slategray';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
    var sha = win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = hover;
    win.style.borderColor = hover;
    obj.nextSibling.style.color = hover;
    sha.style.left = x1 + offx;
    sha.style.top = y1 + offy;
    moveable = true;
    }
    //拖动;
    function drag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    if(moveable)
    {
     win.style.left = x1 + event.clientX - x0;
     win.style.top = y1 + event.clientY - y0;
     sha.style.left = parseInt(win.style.left) + offx;
     sha.style.top = parseInt(win.style.top) + offy;
    }
    }
    //停止拖动;
    function stopDrag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    win.style.borderColor = normal;
    obj.style.backgroundColor = normal;
    obj.nextSibling.style.color = normal;
    sha.style.left = obj.parentNode.style.left;
    sha.style.top = obj.parentNode.style.top;
    //放开标题栏;
    obj.releaseCapture();
    moveable = false;
    }
    //获得焦点;
    function getFocus(obj)
    {
    index = index + 2;
    var idx = index;
    obj.style.zIndex=idx;
    obj.nextSibling.style.zIndex=idx-1;
    }
    function min(obj)
    {
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling;
    var tit = obj.parentNode;
    var msg = tit.nextSibling;
    var p = tit.firstChild; //取的标题所在的spanvar flg = msg.style.display=="none";
    if(flg)
    {
     win.style.width = win.st;//设置窗口宽度
     sha.style.width = win.st;//设置阴影宽度
     tit.style.width = win.st - 2*2;//设置标题栏宽度
     p.style.width = win.st - 2*12-4;//设置标题宽度 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.st = parseInt(win.style.width);//缓存窗口定义宽度
     win.style.width = 100;//设置窗口宽度
     sha.style.width = 100;//设置阴影宽度
     tit.style.width = 100 - 2*2;//设置标题栏宽度
     p.style.width = 100 - 2*12-4;//设置标题宽度 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 = msg;
    this.obj   = null;
    this.bulid  = bulid;
    this.bulid();
    }
    //初始化;
    function bulid()
    {
    var str = ""
     + "<div id=xMsg" + this.id + " "
     + "style='"
     + "z-index:" + this.zIndex + ";"
     + "width:" + this.width + ";"
     + "height:" + this.height + ";"
     + "left:" + this.left + ";"
     + "top:" + this.top + ";"
     + "background-color:" + normal + ";"
     + "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:10;"
      + "color:white;"
      + "' "
      + "onmousedown='startDrag(this)' "
      + "onmouseup='stopDrag(this)' "
      + "onmousemove='drag(this)' "
      + ">"
      + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;height:70%;overflow:hidden;'><nobr>" + this.title + "</nobr></span>"
      + "<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) + ";"
      + "background-color:white;"
      + "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:" + (this.zIndex-1) + ";"
     + "position:absolute;"
     + "background-color:black;"
     + "filter:alpha(opacity=40);"
     + "'>?</div>";
     //alert(str);
    document.body.insertAdjacentHTML("beforeEnd",str);
    }
    //-->
      

  10.   

    谢谢hbhbhbhbhb1021(天外水火(我要多努力)),问题解决了。可是,阴影部分参数存在误差,能帮忙调整下吗?我JS实在太差,见谅
      

  11.   

    <!--
    //可以打包为js文件;
    var x0=0,y0=0,x1=0,y1=0;
    var offx=6,offy=10;
    var moveable=false;
    var hover='orange',normal='slategray';//color;
    var index=10000;//z-index;
    //开始拖动;
    function startDrag(obj)
    {
    //锁定标题栏;
    obj.setCapture();
    //定义对象;
    var win = obj.parentNode;
    var sha = win.nextSibling;
    //记录鼠标和层位置;
    x0 = event.clientX;
    y0 = event.clientY;
    x1 = parseInt(win.style.left);
    y1 = parseInt(win.style.top);
    //记录颜色;
    normal = obj.style.backgroundColor;
    //改变风格;
    obj.style.backgroundColor = hover;
    win.style.borderColor = hover;
    obj.nextSibling.style.color = hover;
    sha.style.left = x1 + offx;
    sha.style.top = y1 + offy;
    moveable = true;
    }
    //拖动;
    function drag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    if(moveable)
    {
     win.style.left = x1 + event.clientX - x0;
     win.style.top = y1 + event.clientY - y0;
     sha.style.left = parseInt(win.style.left) + offx;
     sha.style.top = parseInt(win.style.top) + offy;
    }
    }
    //停止拖动;
    function stopDrag(obj)
    {
    var win = obj.parentNode;
    var sha = win.nextSibling;
    win.style.borderColor = normal;
    obj.style.backgroundColor = normal;
    obj.nextSibling.style.color = normal;
    sha.style.left = obj.parentNode.style.left;
    sha.style.top = obj.parentNode.style.top;
    //放开标题栏;
    obj.releaseCapture();
    moveable = false;
    }
    //获得焦点;
    function getFocus(obj)
    {
    index = index + 2;
    var idx = index;
    obj.style.zIndex=idx;
    obj.nextSibling.style.zIndex=idx-1;
    }
    function min(obj)
    {
    var win = obj.parentNode.parentNode;
    var sha = win.nextSibling;
    var tit = obj.parentNode;
    var msg = tit.nextSibling;
    var p = tit.firstChild; //取的标题所在的spanvar flg = msg.style.display=="none";
    if(flg)
    {
     win.style.width = win.st;//设置窗口宽度
     sha.style.width = win.st;//设置阴影宽度
     tit.style.width = win.st - 2*2;//设置标题栏宽度
     p.style.width = win.st - 2*12-4;//设置标题宽度 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.st = parseInt(win.style.width);//缓存窗口定义宽度
     win.style.width = 100;//设置窗口宽度
     sha.style.width = 100;//设置阴影宽度
     tit.style.width = 100 - 2*2;//设置标题栏宽度
     p.style.width = 100 - 2*12-4;//设置标题宽度 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 = msg;
    this.obj   = null;
    this.bulid  = bulid;
    this.bulid();
    }
    //初始化;
    function bulid()
    {
    var str = ""
     + "<div id=xMsg" + this.id + " "
     + "style='"
     + "z-index:" + this.zIndex + ";"
     + "width:" + this.width + ";"
     + "height:" + this.height + ";"
     + "left:" + this.left + ";"
     + "top:" + this.top + ";"
     + "background-color:" + normal + ";"
     + "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:10;"
      + "color:white;"
      + "' "
      + "onmousedown='startDrag(this)' "
      + "onmouseup='stopDrag(this)' "
      + "onmousemove='drag(this)' "
      + ">"
      + "<span style='width:" + (this.width-2*12-4) + ";padding-left:3px;height:70%;overflow:hidden;'><nobr>" + this.title + "</nobr></span>"
      + "<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) + ";"
      + "background-color:white;"
      + "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:" + (this.zIndex-1) + ";"
     + "position:absolute;"
     + "background-color:black;"
     + "filter:alpha(opacity=40);"
     + "'>?</div>";
     //alert(str);
    document.body.insertAdjacentHTML("beforeEnd",str);
    }
    //-->
      

  12.   

    还是不行。主要的不足为:
    1,右侧阴影与底部阴影宽度不一致(原来的代码中是一致的,比较美观)
    2,通过修改TITLE的SPAN高度,似乎影响了其它参数的设置?
    3,当我将TITLE中的字体设为12PX(中文需要),效果就更差了。