Lunarpages Web Hosting Forum

Author Topic: Selective Pop up window  (Read 2003 times)

Offline Alston

  • Spaceship Navigator
  • *****
  • Posts: 88
  • CT Insurance Agent
    • Connecticut Health Insurance Brokers
Selective Pop up window
« on: February 03, 2005, 07:14:26 PM »
I want to create a pop-up window for a page with a form.  I wrote something in javascript that works, however it triggers the pop up when my user submits the form as well as when s/he closes the window manually.

I don't want the window to pop-up if the user successfully submits the form.

Can this be done?

leighsww

  • Guest
Selective Pop up window
« Reply #1 on: February 03, 2005, 07:18:18 PM »
You might want to post a link to the page and the javascript, so people can help you better.

Offline Alston

  • Spaceship Navigator
  • *****
  • Posts: 88
  • CT Insurance Agent
    • Connecticut Health Insurance Brokers
Selective Pop up window
« Reply #2 on: February 03, 2005, 07:32:47 PM »
The script that I've used is pretty basic.  It "works" but it triggers the new page even when the user submits the form.  I need to modify it so that it only triggers the pop up when the window is closed explicitly by the user.

Here is a similar script that I use on a page that doesn't have a form:

   <script type="text/javascript" language="Javascript">
      <!-- Hide code from older browsers
      
      window.onunload=openNewWindow
      
      function openNewWindow() {
      FreeServices = window.open("http://1800insurancect.com/Health/thank_you/free_services.htm", "frSrvcs")
   }
      // Stop hiding code -->
   </script>

Offline TWebMan

  • Quantum Encyclopedia Writer
  • *****
  • Posts: 3047
    • Take charge of your site
Selective Pop up window
« Reply #3 on: February 03, 2005, 08:38:40 PM »
There is a window.close event handler.  Hopefully this will help:
http://www.physiol.ox.ac.uk/Computing/Online_Documentation/JavaScript/window.htm#1201877
"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site