# Javascript and action script buttons

**URL:** <https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002>\
**Category:** Uncategorized\
**Created:** [July 4, 2004, 3:51pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002 "2004-07-04T15:51:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![envision1](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@envision1](https://forum.kirupa.com/u/envision1)\
**Post date:** [July 4, 2004, 3:51pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002/1 "2004-07-04T15:51:03Z")

</div>

Ok Im trying to use flash to call up a java script window I have two buttons to open 2 different windows on the same page but the problem is for some reason only one link is opened by the two buttons. Each button opens the montage link any help as to why the mogo button dosn’t open the right link? Below is all my code

\<----------My flash code for the buttons-----------\>

on (press) {  
getURL(“javascript: makeNewWindow() ;if (montage !=null) montage.focus();”);  
}

on (press) {  
getURL(“javascript: makeNewWindow() ;if (mogo !=null) mogo.focus();”);  
}

\<-----My Java Script in the page Head-----------\>

\<script LANGUAGE=“Javascript”\>  
\<!-- Beginning of JavaScript -  
function makeNewWindow() {  
mogo=  
window.open(‘[http://www.angelfire.com/ab7/starfield/mogo\_300k.mov’,‘MotionGraphics’,'resizable,height=400,width=200,scrollbars=yes,top=60,left=60](http://www.angelfire.com/ab7/starfield/mogo_300k.mov','MotionGraphics','resizable,height=400,width=200,scrollbars=yes,top=60,left=60)’)  
newWindow.focus()  
}  
function makeNewWindow() {  
montage=  
window.open(‘[http://www.angelfire.com/ab7/starfield/montage\_300k.mov’,‘Montage’,'resizable,height=400,width=200,scrollbars=yes,top=60,left=60](http://www.angelfire.com/ab7/starfield/montage_300k.mov','Montage','resizable,height=400,width=200,scrollbars=yes,top=60,left=60)’)  
newWindow.focus()  
}

// - End of JavaScript - --\>  
\</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 4, 2004, 6:00pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002/2 "2004-07-04T18:00:10Z")

</div>

Both javascript functions are named the same. Make the second one something like makeNewWindow2 and call that from flash instead.

---

<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 4, 2004, 7:49pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002/3 "2004-07-04T19:49:10Z")

</div>

I thought the javascript had to be in the \<head\> tags of the page. I’ll try putting it in the flash thanks.

---

<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 4, 2004, 8:10pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002/4 "2004-07-04T20:10:40Z")

</div>

or you mean just rename on in flash…

---

<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 4, 2004, 11:04pm UTC](https://forum.kirupa.com/t/javascript-and-action-script-buttons/115002/5 "2004-07-04T23:04:06Z")

</div>

No, the javascript needs to be in the page. The problem is that you named both javascript functions the same- you need to rename one.
