Jump to content

IE & Firefox Popup Malfunction


Amaxa7

Recommended Posts

Currently use the following script and html to induce popups of larger images via a thumbnail image:

<script TYPE="text/javascript"><!--function popup(mylink, Chicks){if (! window.focus)return true;var href;if (typeof(mylink) == 'string')   href=mylink;else   href=mylink.href;window.open(href, Chicks, 'width=400,height=200,scrollbars');return false;}//--></SCRIPT>

Almost positive we found this script at http://www.htmlcodetutorial.com/linking/linking_famsupp_71.html.

<a href="http://www.chicksaddlery.com/Merchant2/graphics/00000001/5735TC-GRN.JPG" onClick="return popup(this, 'Chicks')"><img SRC="http://www.chicksaddlery.com/Merchant2/graphics/00000001/tn5735TC-GRN.JPG" border=0></a>

When applied via Chrome we receive the desired results:-User enters product page-User clicks thumbnail image to view popup of larger version-User clicks another thumbnail image (parent window) and induces a new image in the same popupFirefox and IE both show an original popup as expected:-User opens popup via clicking thumbnail image-User clicks another thumbnail (pw) and establishes a new image in the same popup (but the popup is "hidden" behind the parent window)IMO the average user will probably exit the current popup before trying to view another, but we would like to have the function-ability, found in Chrome, available on all browsers, if at all possible. If all users were to exit the first popup then continue to another popup then we wouldn't be concerned.The following is a link to the current (test) product for this method:http://www.chicksaddlery.com/page/CDS/PROD/5735TCOnce we iron out the discrepancies between browsers I will continue throughout our 6000+ products and apply it to a majority of them.Any hints or input would be greatly appreciated, as I am new to the JS scene.

Link to comment
Share on other sites

I think you need to explicitly call focus() on the child window. To do that you'll need to assign it to a variable.

<script type="text/javascript">//declare the variable that will eventually hold a reference to the child windowvar myWindow;function popup(mylink, Chicks){   if (! window.focus)return true;   var href;   if (typeof(mylink) == 'string')	  href=mylink;   else	  href=mylink.href;      //Set the reference   myWindow = window.open(href, Chicks, 'width=400,height=200,scrollbars');   //If the window is open, call focus() to bring it out front   if (!myWindow.closed) {	  myWindow.focus();   }   return false;}</script>

Link to comment
Share on other sites

It seems pointless to me. I'm not really sure what it would be used for, so it's probably safe to remove that line. It seems like it would be something that was used in the old days when JavaScript was still developing and browsers didn't support many of its features, because all browsers that I know of support the window.focus() function.

Link to comment
Share on other sites

It seems pointless to me. I'm not really sure what it would be used for, so it's probably safe to remove that line.
That's what I was thinking. I removed it earlier and the script still worked properly.Any way to have the window.open to adjust its size to an image?-I've been messing around with this an haven't had any success.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...