Click to See Complete Forum and Search --> : Multiple Pop Ups


dev00
08-05-2003, 08:34 PM
hello,

I have the following code. What is happening is a type is being passed, and then through a switch statement determining which pop up should be opened. I am trying to close the one open pop up before I open the new one. i want only one pop-up open at the time, but I want to make sure the other one get's closed before the new one opens. Any ideas? Right now it just keeps replacing the open popup and keeping it's specs. Here is my code:

function openPopupWindow(url, type)
{
var assetType = type;


var pbHeaderFramesetCode =
'<frameset rows="74,*">'
+ '<frame name="popPBHeader" src="pop_pb_header.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>'
+ '<frame name="contentAsset" src="'+url+'" marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" noresize>'
+ '</frameset>'

switch(assetType){

case "Asset":
pop1WinSpecs = "left=50,top=50,width=650,height=550,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,status=no,tit lebar=no,location=no";
onBlur="popWin.close();"
popWin = window.open(url,"commonWindow",pop1WinSpecs);
if (!popWin.focus())
popWin.focus();
break

case "Authoria_Asset":
pop2WinSpecs = "left=160,top=100,width=650,height=550,scrollbars=yes,toolbar=no,menubar=no,resizable=yes,status=no,t itlebar=no,location=no";
onBlur="popWin.close();"
popWin = window.open("","commonWindow",pop2WinSpecs);
popWin.document.write(pbHeaderFramesetCode)
if (!popWin.focus())
popWin.focus();
break

}
}


Here are the links that are calling the pop ups:

<p><a href="javascript:openPopupWindow('content_htmlAsset.html','Asset')">Asset</a>
<p><a href="javascript:openPopupWindow('content_authoriaAsset.html','Authoria_Asset')">Authoria Asset</a>


Thanks!

Khalid Ali
08-05-2003, 10:31 PM
put popups in the array and name them different.wach popup must have a unique name for you keep track of their individual sopecs.

then loop thru the array closing every one thats opened