# Popups replacing each other

**URL:** <https://forum.kirupa.com/t/popups-replacing-each-other/223633>\
**Category:** Uncategorized\
**Created:** [April 24, 2007, 3:22pm UTC](https://forum.kirupa.com/t/popups-replacing-each-other/223633 "2007-04-24T15:22:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andyryan](https://avatars.discourse-cdn.com/v4/letter/a/edb3f5/32.png) [@andyryan](https://forum.kirupa.com/u/andyryan)\
**Post date:** [April 24, 2007, 3:22pm UTC](https://forum.kirupa.com/t/popups-replacing-each-other/223633/1 "2007-04-24T15:22:53Z")

</div>

hi,

just a quick question…ive got a series of buttons that i want to launch centerd popups which i have achieved using the kirupa tutorial. This works fine except that i am using the popups as a way of displaying an image gallery and so i would like each popup to replace the existing one. At the moment you have to close down one popup and then click a button to view another one. Otherwise when you click on another button, the popup comes to the front of the screen again…but the content remains unchanged. To see what i mean got to [www.apryan.com](http://www.apryan.com) and navigate to portfolio\>posters and click on the buttons.

i am currently using this code applied to a frame:

\_root.openWinCentre = function (url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {  
getURL (“javascript:var myWin; if(!myWin || myWin.closed){myWin = window.open(’” + url + “’,’” + winName + “’,’” + “width=” + w + “,height=” + h + “,toolbar=” + toolbar + “,location=” + location + “,directories=” + directories + “,status=” + status + “,menubar=” + menubar + “,scrollbars=” + scrollbars + “,resizable=” + resizable + “,top=’+((screen.height/2)-(” + h/2 + “))+’,left=’+((screen.width/2)-(” + w/2 + “))+’” + “’)}else{myWin.focus();};void(0);”);  
}

with this then applied to each button:

on (release) {  
//customize the window that gets opened  
// 0 equals NO.  
// 1 equals YES.  
address = “[http://www.apryan.com/largeimages/poster10.html](http://www.apryan.com/largeimages/poster10.html)”;  
target\_winName = “poster10”;  
width = 932;  
height = 400;  
toolbar = 0;  
location = 0;  
directories = 0;  
status = 0;  
menubar = 0;  
scrollbars = 0;  
resizable = 0;  
//sends data back to the function  
\_root.openWinCentre(address, target\_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);  
}

thanks for any help.
