If the created window has different definitions, a new instance of the
window will be created.
Using the same variable ref container for both will cause the first
instances reference to be
lost as well. Also, it would also be better to close any children
windows that may happen to
be open when the current window is closed or references a different URL.
Try the following....
<head>
<script language="JavaScript" type="text/javascript">
<!--
var newWin;
window.name = "theAppWindow";
function popUp(page, name, details) {
if(typeof(newWin != 'undefined') {
if(newWin.name != name) newWin.close(); // First closes popUp
Window if it exists.
}
newWin=window.open(page, name, details);
newWin.focus();
return false;
}
function popUpClose() {
if(typeof(newWin != 'undefined') newWin.close();
}
window.onunload = popUpClose;
//-->
</script>
</head>
<body>
<a href="help.cfm" onClick="return popUp('help.cfm', 'theHelpWindow',
'width=400,height=500')">Help</a>
<a href="index.cfm" onClick="return
popUp('index.cfm?fuseaction=Work.StepDetail&Step=1', 'theDetailWindow',
'width=600,height=500')">DETAILS></a>
</body>
Conrad
-----Original Message-----
From: Brian Scandale [mailto:[EMAIL PROTECTED]]
Sent: 12 March 2002 08:18 PM
To: CF-Talk
Subject: RE: popUp Window trouble
Steve,
It does work. It uses the same window for all the Help instances but
every instance of Details opens a new window.
Anybody else have an idea?
thanks,
Brian
At 03:43 AM 3/12/02 -0500, you wrote:
>That looks like it should work...
>
>window.open('url', 'windowName', 'properties');
>
>The only thing I noticed is the name is pretty long, "theDetailWindow",
>not sure if it matters but you could try using a shorter name.
>
>Other then that I noticed you have the href set in the link. When I
>use a link to popup a window with the onclick even I usually set the
>href to "#" or "javascript:void(0)"
>
>_____________________________
>steve oliver
>senior internet developer
>atnet solutions, inc.
>http://www.atnetsolutions.com
>
>
>-----Original Message-----
>From: Brian Scandale [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, March 12, 2002 3:00 AM
>To: CF-Talk
>Subject: popUp Window trouble
>
>
>One of my popUps always uses the same window for display... as
>expected. The other always generates a new window... (which clutters
>the desktop and uses resources). Both are called from the same page.
>
>I have a header that always has a help button in it. It calls help.cfm
>which pops up a help window with the contents of #Client.HelpIs#. If I
>navigate to a new page and press help, the old help window repopulates
>with New help info.
>
>Another page has a list of items each with a button for "Details" by
>each lineitem. Every press of the detail button brings up a new
>DetailWindow, ...even If I press the SAME Detail button. I am looking
>for all details to use the same window.
>
>As far as I can tell it is identical code... so I'm at a adjust this.
>
>The code:
><head>
><script language="JavaScript" type="text/javascript">
> <!--
> window.name = "theAppWindow";
> var newWin;
> function popUp(page, name, details) {
> newWin=window.open(page, name, details);
> newWin.focus();
> return false;
> }
> //-->
></script>
></head>
><body>
>
><a href="help.cfm" onClick="return popUp('help.cfm', 'theHelpWindow',
>'width=400,height=500')">Help</a>
>
><a href="index.cfm" onClick="return
>popUp('index.cfm?fuseaction=Work.StepDetail&Step=1', 'theDetailWindow',
>'width=600,height=500')">DETAILS></a>
>
></body>
>
>As it so happens... the href= is of no consequence... i can put
>anything in there... it's the popUp('page' that counts.
>
>Anybody know how I might start trying to fix this?
>
>thanks,
>Brian
>
>
>
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists