JavaScript Popup Window Tutorial
By: Meg Stevens

This tutorial will detail how to create a JavaScript pop-up window to be opened from a button in a flash movie. This tutorial will assume that you already know how to create a button in flash as well as how to publish your movies html. This script will work with 4.0 browsers and higher.

1) First you will need to have a button created. You will give your button a get URL action and add, exactly as it appears here, the following to your button in the URL field;
 
Javascript:popupwindow( )

Be sure that you do not set a window target or it won't work.
This serves as a trigger that will prompt the script we will be adding to our HTML.

2) With that all done, we can move onto the slightly harder part, editing your HTML. This is not to difficult though, as I'm sure you know.
We need to add the script that will be triggered buy our Get URL button. The following script can be cut and pasted into our HTML between the Title and the Head.


<script LANGUAGE="JavaScript">
function popupwindow(){
window.open("view.html","","height=425,width=550,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left=0,top=0")
}
</script>

3) You will of course need to edit the link, height, and width as needed for this script to function properly with your specific needs.

4) To create a close window button simply add the following code to your html link or to another Get URL button in Flash;
 
javascript:window.close()

This same method for launching a JavaScript Pop-Up will work for HTML as well as Flash. To create more then one pop-up window, you can give each button call a unique name or number your windows. Remember to edit your JavaScript code accordingly.

[ back ]