# Button pops up HTML

**URL:** <https://forum.kirupa.com/t/button-pops-up-html/56811>\
**Category:** flash\
**Created:** [July 7, 2004, 10:11pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811 "2004-07-07T22:11:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![El\_Thierro](https://avatars.discourse-cdn.com/v4/letter/e/858c86/32.png) [@El\_Thierro](https://forum.kirupa.com/u/El_Thierro)\
**Post date:** [July 7, 2004, 10:11pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/1 "2004-07-07T22:11:59Z")

</div>

Hi guys,

I’m having trouble creating some kind of code/actionscript to add to a button, which will make a HTML window pop-up with a picture inside. If possible, the window should close again if the picture is clicked…

Anyone have any ideas how I should do this?

I tried a couple of K’s tuts but they didn’t work ☹

Cheers

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 8, 2004, 9:00am UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/2 "2004-07-08T09:00:00Z")

</div>

yes you can do it with Flash + JavaScript

#1 . on(release) of flash btn call a javascript Function.  
eg. on(release){  
getURL(“javaScript:openPopup()”)

#2. In javascript function open the new window  
function openPopup(){  
var newWin = window.open(“file Name”,“new name”, “features”)  
}  
#3. on Click of Image call a function that close the window  
window.close()

Please feel free to ask if u have further doubt

regards  
Ajo.K.jose

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2004, 12:19pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/3 "2004-07-12T12:19:51Z")

</div>

Thanks already, but I still don’t quite get it…

What would be the code _in full_ to put on the button itself?

I know it’s:

> on(release){  
> getURL(“javascript:openPopup()”)  
> But where inside that code does

> function openPopup(){  
> var newWin = window.open(“file Name”,“new name”, “features”)  
> }

go?  
And what should I put for “features”?

:ne:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 4:09am UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/4 "2004-07-13T04:09:26Z")

</div>

features refers to open window features ; find here full code

\<script language=“JavaScript”\>  
function openPopup(){  
var newWindow = windo.open(“popup.html”,“myWindow”,"height=200 width=100 scrollbar=0 menubar=0 statusbar=0 ")  
}  
\</script\>

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:18pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/5 "2004-07-13T21:18:00Z")

</div>

Okay, thanks a lot mate :party:

Cheers 🍺

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 9:36pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/6 "2004-07-13T21:36:11Z")

</div>

El - Does it work?

If you want I could give you a tutorial right now on how to open the window and close when the picture is clicked :).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 10:19pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/7 "2004-07-13T22:19:07Z")

</div>

1. On the button, have this code - Do **not** edit target winName:

```auto
on (release) {
	address = "http://www.kirupa.com/modular/pop-up.htm";
	target_winName = "kirupa";
	width = 400;
	height = 300;
	toolbar = 0;
	location = 0;
	directories = 0;
	status = 0;
	menubar = 0;
	scrollbars = 1;
	resizable = 0;
	openWinCentre(address, target_winName, width, height, toolbar, location, directories, status, menubar, scrollbars, resizable);
}

```

1. On the frame of that button, have this code:

```auto
_global.openWinCentre = function(url, winName, w, h, toolbar, location, directories, status, menubar, scrollbars, resizable) {
        getURL("javascript: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+"))+'"+"');void(0);");
};

```

1. Create your HTML page that will popup and use an img tag to insert the picture and what not. I think the picture should be aligned at the very top left of it, or either in the middle. I dont know, try stuff out.

2. Make sure you image img tags are like this:

```auto
<img src="URL" width="BLAH" height="BLAH" onclick="window.close();">

```

–

:).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 10:26pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/8 "2004-07-13T22:26:14Z")

</div>

Okay, thanks Sharif :thumb:

😉 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 13, 2004, 10:26pm UTC](https://forum.kirupa.com/t/button-pops-up-html/56811/9 "2004-07-13T22:26:58Z")

</div>

No problem :).
