|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi everyone. I'm having trouble with this effect and wanted to know if anyone can lend a hand. I'm sure it's easy as pie, but I can't find the error(s). I'm setting up an "exit questionaire". Whenever a client leaves the site (by closing the window, buy manually writing in a new URL or whatever) I want a new window to pop up to ask them about their experience on the site (I think this is a terrible idea but my client wants it....) It's easy to get one to do that whenever you leave the site, but I DON"T want it to happen when someone navigates forward through the site links. This was my solution (which doesn't work): (in the head section) <script language="javascript"><!-- function goExit(stay) { if (stay == "no") { nextWin=window.open('http://www.weight-loss-diet-4u.com/form.html','lastWin','status=no,resizable=yes,scrollbars=yes,location=no,left=0,top=0,width=700,heig ht=500'); } } //--> </script> (in the body tag) <BODY onUnload="goExit('no')" BGCOLOR="#FFFFFF" VLINK="0000FF"> (in the body - nav link) <A HREF="http://www.next.com" onClick="goExit('yes')"><B>CLICK HERE</B></A> Why won't this work? Any ideas? What happens it the darn thing ALWAYS pops it up. Any other scripts that do this would be welcome as well. Thanks!! |
|
#2
|
|||
|
|||
|
The reason is that your logic is not correct. The onClick will fire whenever you click the link, with stay="yes", and afterwards the onUnload will fire, with stay="no". What you need to do is have all of your internal links have a function in the onClick that sets some global boolean, then in your goExit, test that boolean to see if it's an internal or external link.
|
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > popin up a new window - sometimes |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|