rt,就是如何把对话框放在屏幕的中央或其他指定的位置?

解决方案 »

  1.   

    共同进步,不惜血本:
    function onOpenWindow()
    {
        var x = screen.width - 200;
        var y = 90;
        
        var vOpenWindow = window.open(url,MyWindow,"width="+x+"px,height="+y+"px,
    resizable=1,scrollbars=1,left="+mLeft+"px,top="+mTop+"px");   return vOpenWindow;
    }
       有些东东,自己处理吧。
      

  2.   

    [html]
    <script>
    theDes="status:no;center:yes;help:no;minimize:yes;maximize:no;dialogWidth:350px;scroll:no;dialogHeight:200px";
    self.showModalDialog("http://www.sina.com.cn",null,theDes);
    self.showModelessDialog("http://www.lshdic.com",null,theDes);
    </script> 
    [/html]
      

  3.   

    兄弟,我需要的是java版本阿-_--!!!!!!!!!
      

  4.   

    //窗口居屏幕或父窗口中间,c的父窗口如果为空,则居屏幕中间
        public static void centerFrame(java.awt.Component c) {
            Dimension ownerSize;
            Point ownerLocation;
            if (c.getParent() == null) {
                ownerSize = Toolkit.getDefaultToolkit().getScreenSize();
                ownerLocation = new Point(0, 0);
            } else {
                ownerSize = c.getParent().getSize();
                ownerLocation = c.getParent().getLocation();
                if (ownerSize.height == 0 || ownerSize.width == 0
                        || !c.getParent().isVisible()) {
                    ownerSize = Toolkit.getDefaultToolkit().getScreenSize();
                    ownerLocation = new Point(0, 0);
                }
            }
            //Center the window
            Dimension frameSize = c.getSize();
            if (frameSize.height > ownerSize.height) {
                frameSize.height = ownerSize.height;
            }
            if (frameSize.width > ownerSize.width) {
                frameSize.width = ownerSize.width;
            }
            c.setLocation(
                    ownerLocation.x + (ownerSize.width - frameSize.width) / 2,
                    ownerLocation.y + (ownerSize.height - frameSize.height) / 2);    }