View Full Version : makeNewWindow function - multiple parameters

08-19-2002, 06:17 PM
How do I set different parameters in a document where I call a "makeNewWindow" function multiple times?

I am working with an HTML document with multiple rollovers, each of which should call a different HTML document & make it a popup window. I'm not sure how to make these different HTML docs appear for each rollover and how to set up the x & y coordinates so they will be different each time.

FYI - the rollovers also have DreamWeaver's "swapImage" function associated with each.

Does this make sense? If so, please see the attached text file (an abridged version of the document, just to show the JS & where I've inserted it in the HTML section).

Any help is much appreciated!


08-19-2002, 06:45 PM
Since you are already useing Dreamweaver, you can use it's built in ability to create popup windows. Hit Shift+F3 to open the 'Behaviors' window (DW's pet name for javascript stuff) and use the Plus Sign button to add 'Open Browser Window' to your links.

08-19-2002, 08:15 PM
Thanks, Beetle,

I took your advice - the DW-generated function works well. I still wonder how I can set the x, y coordinates for the popup window, and how I can make the window close when the mouse moves off the image.

Any advice on this part? thanks!

08-19-2002, 08:23 PM
well, come to think of it, that MM_openBrWindow function kinda sucks. Here' something better.

function popWin(nUrl,wName, w, h, l, t)
var features = "";
features += 'width='+w;
features += ',height='+h;
features += ',left='+l;
features += ',top='+t;
var poppedWin = window.open(nUrl,wName,features);
} Then to call the function, use this
popWin('page.htm','myWin',300,400,100,50); This will open page.htm in a window named 'myWin' that is 300x400 and 100px from the left, and 50px from the top.

08-19-2002, 08:46 PM
then, to close the window....
function closeWin() {
if (poppedWin)

<a href="whaveter.htm" onMouseOut="closeWin()">Link</a>

08-19-2002, 09:35 PM
Hmmm, still having trouble (sorry to be a pest)...

The window opens using the function popWin ; however, the size and coordinates I input don't seem to make a difference.

I can't get the closeWin function to work - being so new at this, maybe I've forgotten something...

Thanks for all your help! I wish I could somehow return the favor!
Attached is the code, as I inserted it. Please let me know if the error I've made jumps out at you - it's probably obvious to the experienced JS writer!


08-19-2002, 09:46 PM
Ok, let's take a look at what you've got, and what you need. First, what you got
<a href="/products/con_div.htm" onMouseOver="MM_swapImage('prod_menu_r2_c2','','fireworks/prod_menu_r2_c2_f2.gif',1);popWin('product_win/contract.htm','contract','width=400,height=100,left=760,top=180')" onMouseOut="MM_swapImgRestore();" "closeWin('contract')"> Now, for what you need:
<a href="/products/con_div.htm" onMouseOver="MM_swapImage('prod_menu_r2_c2','','fireworks/prod_menu_r2_c2_f2.gif',1);popWin('product_win/contract.htm','contract',400,100,760,180)" onMouseOut="MM_swapImgRestore();closeWin();">