我使用JavaScript作为弹出窗口。 但是我想要它做的是将弹出的页面加载到某个区域,指定为X& Y坐标。
我目前的代码是:
function openwindow()
{
window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px");
}
这是否可以实现,如果是,如何,基于我提供的代码。
由于
答案 0 :(得分:2)
在第3个参数中添加left
和top
答案 1 :(得分:1)
使用top和left参数,例如window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px,top=0,left=0");
话虽如此,管理弹出窗口可能很麻烦。如果您的应用程序没有必要,我只需在您的实际页面中创建一个DHTML对话框,例如jQuery的对话框jqueryui.com/demos/dialog。
答案 2 :(得分:1)
您可以将top=?px,left=?px
添加到您的媒体资源中。例如
function openwindow()
{
window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px,top=100px,left=150px");
}
答案 3 :(得分:1)
如果您想将弹出窗口放在屏幕上,可以在打开窗口时使用screenX和screenY属性,如下所示:
window.open("index.php?dll=gallery&sub=upload", "mywindow", "menubar=1, resizable=1, width=660px, height=390px, screenX=80, screenY=300")