Tuesday, November 3, 2009

Reusing Popup Windows

Rather than annoy your visitors more than necessary by creating separate popup windows for each of these (and potentially ending up with lots of windows on their screen) we can reuse the existing popup window when they click on a second (and subsequent links) that are set to open a popup window.

To create popup window:
window.open('mywin.htm','name','height=255,width=250,
continued from previous line toolbar=no,directories=no,status=no,menubar=no,
continued from previous line scrollbars=no,resizable=no');

or

TheNewWin = window.open('','name','height=255,width=250,
continued from previous line toolbar=no,directories=no,status=no,menubar=no,
continued from previous line scrollbars=no,resizable=no');

The second parameter (in bold) gives the popup window a name. If there exists a window with the same name already opened, then the popup window will be reused.

No comments:

Post a Comment