< Back

Document Subject: Have pop up dialogues pop up near your cursor
Hint Short Cut: Add this to your code & documentation to help you find this page.
http://#SmartDialogueLocations or http://A555F9/nn.nsf/ByAlias/SmartDialogueLocations

As web forms become more complicated, it is nice when the pop up dialogues or dialogs that are used pop up near the button or field clicked on with the pointer. Here is a very cool way of doing this:




In the onClick event of the notes form or web form put:

if (navigator.appName == "Microsoft Internet Explorer") {
iWinX = window.event.screenX;
iWinY = window.event.screenY;
}

 

As backup for Netscape users etc , put in the onLoad event :

var iWinX = 100;
var iWinY = 100;

 

Then in your button code put:

namelistwindow = window.open('', '', 'height=155,width=200,screenX=200,screenY=300,top=' +(iWinY-10)+',left='+(iWinX+10)+',resizable=yes,location=no,scrollbars=yes,menubar=no,toolbar=no,directories=no');

Change the -10 and +10 to suit the size of your button. Brilliant.