var str = "height=" + height + ",innerHeight=" + height; 
str += ",width=" + width + ",toolbar=no,directories=no,status=no,scrollbars=auto,resize=no,menubar=no,innerWidth=" + width;

解决方案 »

  1.   

    function WindowOpenCenter(url, width, height, otherFeatures)
    {
      var openArgs;
      if (otherFeatures)
        openArgs = otherFeatures;
      else 
        openArgs = "";
      
      openArgs += ", width=" + width;
      openArgs += ", height=" + height;
      openArgs += ", top=" + ((window.screen.availHeight-height)/2);
      openArgs += ", left=" + ((window.screen.availWidth-width)/2);  return window.open(url, "", openArgs);
    }WindowOpenCenter("", 300, 410, "scrollbars=yes");
      

  2.   

    function ScreenCenter(url, name, height, width,other) { 
    var str = "height=" + height + ",innerHeight=" + height; 
    str += ",width=" + width + ",innerWidth=" + width; 
    str += other
    if (window.screen) { 
           var ah = screen.availHeight - 30; 
           var aw = screen.availWidth - 10; 
           var xc = (aw - width) / 2; 
           var yc = (ah - height) / 2; 
           str += ",left=" + xc + ",screenX=" + xc; 
           str += ",top=" + yc + ",screenY=" + yc; 
           } 
    return window.open(url, name, str); 
    }调用:
    onClick="ScreenCenter('xxx.asp','send',250,350,'toolbar=no,directories=no,status=no,scrollbars=auto,resize=no,menubar=no');"