js open打开新窗口操作父窗口

来源:互联网 发布:千牛mac版什么时候出 编辑:程序博客网 时间:2024/05/29 12:51

 父窗口


function myMenu(url,num)

            {
                   var obj = new Object();
                   url=url+"&pUserId="+num;
                   openwindow(url, obj, 420, 480);
            }
            function openwindow(url, obj, iWidth, iHeight) {
                var iTop = (window.screen.height - 30 - iHeight) / 2;       //获得窗口的垂直位置;  
                var iLeft = (window.screen.width - 10 - iWidth) / 2;        //获得窗口的水平位置;  
                window.open(url, obj, 'height=' + iHeight + ',innerHeight=' + iHeight + ',width=' + iWidth + ',innerWidth=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');

            }


子窗口

//这里是获取父窗口对象

var windowOpener=window.opener;
            windowOpener.location.reload(true);
            window.close();



原创粉丝点击