Click to See Complete Forum and Search --> : Is Window Open Already?


marcl97
11-09-2003, 03:55 PM
On my parent window, I have links that open smaller pop-up windows. I want to prevent users from trying to open a pop-up that is already opened. Any way to detect if a pop-up is already open and prevent it from being opened a second, third, etc. time?

Tx.

fredmv
11-09-2003, 04:31 PM
If you assign it to a variable there will only be one nstance of it at all times, and when the user attempts to open it again, the window will be brought back to the top of the window stack (much like the focus method).<script type="text/javascript">
function pop(url)
{
window.open(url, '', 'height=300,width=300,scrollbars=1');
}
</script>Then, you could use it like this:<a href="http://www.google.com/" onclick="pop(this.href);return false;">Google.</a>Good luck.

marcl97
11-09-2003, 05:22 PM
Tx for replying but I don't understand the answer you gave. Have tried the code... keep getting error msg. : c is undefined. Can u clarify please?

fredmv
11-09-2003, 05:42 PM
Sorry, I edited it. It should work just fine now.