I am using JavaScript as a popup. But what I'd like it to do is load the popped up page in a certain area, Specified by say an X & Y coordinate.
My current code is :
function openwindow()
{
window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px");
}
Is this achievable and if so, How, based on the code I've supplied.
Thanks
I am using JavaScript as a popup. But what I'd like it to do is load the popped up page in a certain area, Specified by say an X & Y coordinate.
My current code is :
function openwindow()
{
window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px");
}
Is this achievable and if so, How, based on the code I've supplied.
Thanks
Share Improve this question asked Nov 1, 2011 at 14:27 StuBlackettStuBlackett 3,84915 gold badges71 silver badges116 bronze badges 2- Have a look at: developer.mozilla/en/DOM/… – Rob W Commented Nov 1, 2011 at 14:30
- 1 possible duplicate of Set position for new window – Quentin Commented Nov 1, 2011 at 14:31
4 Answers
Reset to default 2use the parameters top and left, e.g. window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px,top=0,left=0");
Having said that, managing popup windows can be troublesome. If it's not necessary for your application, I would simply create a DHTML dialog in your actual page, e.g. jQuery's dialog, jqueryui./demos/dialog .
In the 3rd parameter add a left
and a top
You can add top=?px,left=?px
to your propperties. For example
function openwindow()
{
window.open("index.php?dll=gallery&sub=upload","mywindow","menubar=1,resizable=1,width=660px,height=390px,top=100px,left=150px");
}
If you would like to position the popup on the screen, you can use the screenX and screenY properties when opening a window, like so:
window.open("index.php?dll=gallery&sub=upload", "mywindow", "menubar=1, resizable=1, width=660px, height=390px, screenX=80, screenY=300")