Link to home
Start Free TrialLog in
Avatar of imac_jim
imac_jim

asked on

Close child popup preview window when parent becomes focus window again

Hi,

I am having some trouble. I have looked at onBlur commands and there are errors between Mac IE 5 and Windows IE.

What I have is a parent page of thumbnail pictures. Each picture has a url to spawn a larger child 'Detail' preview.

<!-- Script used in parent window to spawn child -->
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
  winName.focus();
}
//-->
</script>

This is what I am using as the link on the page to get my larger preview window. I use the window name 'Detail' for all of them.

<a href="javascript:;" onMouseDown="MM_openBrWindow('images/landscape/1138.htm','Detail','scrollbars=yes,width=580,height=600,dependent=yes')"><img vspace="10" hspace="10" src="images/landscape/thumbs/1138.jpg" border="0"></a>

In the larger Detail window a large image is displayed with previous and next links. The user will click on these if they wish to cycle through images. What I want though is when the user clicks back on the parent thumb window that the child detail window is closed.

I tried a close from the child window when a onblur was triggered in the body tag but this would trigger even if the user clicks anywhere within the detail window eg the previous and next links.

Anythoughts to getting round this?
Avatar of GIMLI
GIMLI

try this
 use different picture to this code
replace all the image in the code

<html>
<head>
 <SCRIPT LANGUAGE="javascript">

<!-- hide from none JavaScript Browsers              

Image1 = new Image(265,406)
Image1.src = "ep.gif"

Image2 = new Image(265,406)
Image2.src = "3.gif"

Image3 = new Image(265,406)
Image3.src = "4.gif"                                        

Image4 = new Image(265,406)
Image4.src = "1.gif"                                        

Image5 = new Image(265,406)
Image5.src = "2.gif"                                        

Image6 = new Image(265,406)
Image6.src = "5.gif"                                        

Image7 = new Image(265,406)
Image7.src = "6.gif"                                        
Image8 = new Image(265,406)
Image8.src = "7.gif"                                        

function zoomin() {
document.emp.src = Image3.src; return true;
}

function zoomout() {
document.emp.src = Image2.src; return true;
}

function original() {
document.emp.src = Image1.src; return true;

}
function o() {
document.emp.src = Image4.src; return true;

}
function p() {
document.emp.src = Image5.src; return true;

}
function i() {
document.emp.src = Image7.src; return true;

}

// - stop hiding -->
</SCRIPT>

<body>
<IMG NAME="emp" SRC="ep.gif" USEMAP="#ep">

<MAP NAME="ep">
<AREA SHAPE="RECT" COORDS="369, 84, 396, 119" NOHREF >
<AREA SHAPE="RECT" COORDS="313, 32, 336, 62" NOHREF >
<AREA SHAPE="RECT" COORDS="272, 43, 300, 69" NOHREF >
<AREA SHAPE="RECT" COORDS="275, 96, 302, 126" NOHREF onMouseOver="i()"  onMouseOut="original()">
<AREA SHAPE="RECT" COORDS="220, 82, 248, 111" NOHREF onMouseOver="zoomin()" onMouseOut="original()">
<AREA SHAPE="RECT" COORDS="127, 80, 154, 109" NOHREF onMouseOver="p()" onMouseOut="original()">
<AREA SHAPE="RECT" COORDS="17, 96, 45, 125" NOHREF onMouseOver="zoomout()" onMouseOut="original()">
<AREA SHAPE="RECT" COORDS="59, 31, 82, 58" NOHREF onMouseOver="o()" onMouseOut="original()">





<AREA SHAPE="default" nohref>

</MAP>


</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of imac_jim

ASKER

Thanks for your help! I have tested it and at this stage works fine cross platform.
Glad to have helped,

Fritz the Blank