# Pop-up window script help

**URL:** https://forum.kirupa.com/t/pop-up-window-script-help/13886
**Category:** Uncategorized
**Created:** [February 19, 2003, 1:41pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886 "2003-02-19T13:41:30Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![snakekiller](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@snakekiller](https://forum.kirupa.com/u/snakekiller)
#### Post date: [February 19, 2003, 1:41pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/1 "2003-02-19T13:41:30Z")

</div>

What would you add to this script to be able to keep the scrollbars? This opens a pop up but not resizable and without scrollbars.

on (release) {  
uUrl = “[http://the](http://the) url of the html you want to open”;  
wdth = “the width you want”;  
hdth = “the height you want”;  
getURL (“javascript:window.open(’“add uUrl add” ',‘nName’,'width=” add  
wdth add “,height=” add  
hdth add “,top=’+((screen.availHeight/2)-(” add hdth/2 add  
“))+’,left=’+((screen.availWidth/2)-(” add  
wdth/2 add “))); void(0);”);  
}

---

<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: [February 20, 2003, 10:48am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/2 "2003-02-20T10:48:13Z")

</div>

This is untested but to open a new window using javascript you would add scrollbars=yes to the code

---

<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: [February 20, 2003, 1:36pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/3 "2003-02-20T13:36:18Z")

</div>

right,  
But where? I’ve tried putting it in amost every spot in that code.

---

<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: [February 21, 2003, 5:44am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/4 "2003-02-21T05:44:41Z")

</div>

Try something like this:  
getURL(javascript:openNewWindow(‘[http://www.macromedia.com](http://www.macromedia.com)’,‘myWindow’, ‘height=400,width=400,toolbar=no,scrollbars=yes’);

And of course you can replace the URL stuff with your variables, but that’s the basic syntax of it. Broken down, it goes like this…

getURL(javascript:openNewWindow(URL,WindowName,WindowAtrtributes);

Hope this helps.

---

<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: [February 21, 2003, 5:45am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/5 "2003-02-21T05:45:26Z")

</div>

Hehe…you also need some javascript on the page.

\<script language=“JavaScript”\>  
function openNewWindow(URLtoOpen, windowName, windowFeatures) {  
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }  
\</script\>

Sorry.

---

<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: [February 21, 2003, 5:46am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/6 "2003-02-21T05:46:35Z")

</div>

//\<script language=“JavaScript”\>  
//function openNewWindow(URLtoOpen, windowName, //windowFeatures) {  
[//newWindow=window.open](https://newWindow=window.open)(URLtoOpen, windowName, //windowFeatures); }  
//\</script\>  
It’s not letting me post this…trying to comment it.

---

<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: [February 21, 2003, 5:47am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/7 "2003-02-21T05:47:31Z")

</div>

function openNewWindow(URLtoOpen, windowName, windowFeatures) {  
newWindow=window.open(URLtoOpen, windowName, windowFeatures); }

all this goes inside the script tags. Sorry for the multiple posts.

---

<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: [February 21, 2003, 5:50am UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/8 "2003-02-21T05:50:06Z")

</div>

Looking back, I could have answered your question a lot quicker. You just need the scrollbar attribute in commas in the the third section. AHHH!!! CONFUSION!!!

---

<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: [February 21, 2003, 1:28pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/9 "2003-02-21T13:28:59Z")

</div>

Mr. Twinkles,

Please show me where you are talking about putting the scrollbar=yes code.  
Like I said, I’ve tried putting it in every spot in that code with no results.

Snake

---

<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: [February 21, 2003, 2:54pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/10 "2003-02-21T14:54:46Z")

</div>

try this. In the flash movie, put this code:

on(release){  
getURL(“javascript:myPopup();”);  
}

in the html page, put this in the head section between script tags.

function myPopup(){  
myURL = “[http://www.google.com](http://www.google.com)”  
window.open(‘[http://www.google.com](http://www.google.com)’, ‘mywindow’,‘toolbar=yes,scrollbars=yes,location=yes,statusbar=yes,menubar=yes,resizable=yes,width=400,height=300,left = 300,top = 200’);  
}

and you can edit all the attributes. I’m pretty sure you can put everything in the flash movie, but this could be easier. You can set it up to where everything is a variable if you’d like, and then just pass the variable in flash like:  
getURL(“javascript:myPopup(URL,toolbar,scrollbar,etc)”);  
just make sure you change the myPopup function in the html page to accept the variable within the window.open(); part of it.

Hope this works for you.

---

<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: [February 21, 2003, 4:01pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/11 "2003-02-21T16:01:09Z")

</div>

thanks,

but I was trying to avoid any html script.

thanks for your time anyway.

Snake

---

<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: [February 21, 2003, 4:08pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/12 "2003-02-21T16:08:48Z")

</div>

Ok, here’s the same deal without any html. When you test this in flash, use Ctrl + F12 to test in the browser. That way it doesn’t pop up the extra window like Ctrl + Enter will. Anyway, here’s the code:

on (release) {  
getURL(“javascript:window.open(‘[http://www.google.com](http://www.google.com)’,‘MyWindow’,‘toolbars=no, scrollbars=yes, resizable=no, width=200, height=500, menubar=yes, left=300, top=500’)”);  
}

Sorry for not getting this how you wanted sooner. Have fun.

---

<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: [February 21, 2003, 4:39pm UTC](https://forum.kirupa.com/t/pop-up-window-script-help/13886/13 "2003-02-21T16:39:42Z")

</div>

Ah, ok  
So the left= and top= specify where the window opens on the x-y axis?

thanks man.
