Position modal dialog box relative to screen
I want to position a modal dialog popup on the bottom right corner of the user's monitor. Right now I use these parameters, which work on most regular aspect monitors:
But on a widescreen monitor it doesn't go as far right as it should, and I don't want to increase the dialogLeft parameter any more in case someone has a browser that would make the window appear off the screen.
window.showModalDialog("url", "","dialogWidth:400px; dialogHeight:400px; dialogTop:600px; dialogLeft:800px; center:no; status:no")
So I find out the user's screen size, and set two parameters to use as a position, like this:
Now I should be able to put x and y into dialogLeft and dialogTop in the popup code, but they just don't work.
var x = window.screen.availWidth - 400;
var y = window.screen.availHeight - 400;
Is there a syntax for this which I am missing?