# Need to Modify a Kirupa Pop-up Tute

**URL:** <https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684>\
**Category:** web dev\
**Created:** [May 29, 2008, 8:36pm UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684 "2008-05-29T20:36:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![will\_s](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@will\_s](https://forum.kirupa.com/u/will_s)\
**Post date:** [May 29, 2008, 8:36pm UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684/1 "2008-05-29T20:36:06Z")

</div>

Sometime ago, I read Kirupa’s Javascript tutorial: “Launching a Centered Pop-Up Window” and used the code to good effect on four buttons on a swf that brought up four different html pop-ups. However, I always had to warn the viewer to manually close each one when finished or clicking on the next one would only bring back the first one.

Now I would like to modify the code so that the first one closes automatically when you click on the second one (etc.)

I’ve tried making the target\_winName the same – and different – but neither worked. And I’ve looked all over the web and in a javascript book, to no avail. I’ve even tried an on (press) lead-in code sort of like this:  
on (press) {  
window.close(“aaronCreditsActor.html”);

that I would apply to each, to “shotgun” the closing the other three. But it doesn’t work either.

Any ideas? How about blur()? Thanks.

---

<div class="post-metadata">

**Author:** ![simplistik](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/simplistik/32/7747_2.png) [@simplistik](https://forum.kirupa.com/u/simplistik)\
**Post date:** [May 30, 2008, 1:59pm UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684/2 "2008-05-30T13:59:31Z")

</div>

ummm if you did it strictly w/ JS you would do something like

```auto

<script type="text/javascript">
function openWindow() {
     somewindow = window.open("http://www.google.com","somewindow","location=no");
}
</script>

```

to toggle the window open and close you’d do

```auto

<input type="button" onclick="openWindow()" value="Open 'somewindow'" />
<input type="button" onclick="somewindow.close()" value="Close 'somewindow'" />

```

---

<div class="post-metadata">

**Author:** ![actionAction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/actionaction/32/3987_2.png) [@actionAction](https://forum.kirupa.com/u/actionAction)\
**Post date:** [May 31, 2008, 5:01am UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684/3 "2008-05-31T05:01:00Z")

</div>

In the body tag of your individual popup windows place this code:

```auto

<body onblur="javascript:self.close();">

```

---

<div class="post-metadata">

**Author:** ![will\_s](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@will\_s](https://forum.kirupa.com/u/will_s)\
**Post date:** [May 31, 2008, 5:15pm UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684/4 "2008-05-31T17:15:57Z")

</div>

I tried actionAction’s onblur solution first and it worked!

(I think simplistik’s would have required modifications I would have struggled with.)

Thanks again!!

---

<div class="post-metadata">

**Author:** ![actionAction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/actionaction/32/3987_2.png) [@actionAction](https://forum.kirupa.com/u/actionAction)\
**Post date:** [May 31, 2008, 6:52pm UTC](https://forum.kirupa.com/t/need-to-modify-a-kirupa-pop-up-tute/261684/5 "2008-05-31T18:52:57Z")

</div>

No problem!
