Lunarpages Web Hosting Forum

Author Topic: JavaScript pop up  (Read 4108 times)

Offline Alston

  • Spaceship Navigator
  • *****
  • Posts: 88
  • CT Insurance Agent
    • Connecticut Health Insurance Brokers
JavaScript pop up
« on: August 13, 2008, 07:34:06 PM »
Is there a way to have a pop up window that responds to the unload, but that is inhibited if the visitor clicks the "submit" button?

Offline scanman20

  • Senior Moderator
  • Über Jedi
  • *****
  • Posts: 1556
    • http://www.notonebit.com
Re: JavaScript pop up
« Reply #1 on: August 14, 2008, 05:51:46 AM »
I'm not clear on what it is that you're trying to do, can you give an example?
Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP (<- unused since 2006!)

Offline Alston

  • Spaceship Navigator
  • *****
  • Posts: 88
  • CT Insurance Agent
    • Connecticut Health Insurance Brokers
Re: JavaScript pop up
« Reply #2 on: August 14, 2008, 07:02:57 AM »
I want to put a pop up window on a page with a form.  The pop up window will give the user an incentive to complete the form if they haven't done so.

If I use window.onuload without some kind of if/then construct, the pop up will occur whether or not the person submitted the form.  I don't want to annoy people who are doing what I want them to do.

I only want the pop up to display if they don't submit the form.

Offline scanman20

  • Senior Moderator
  • Über Jedi
  • *****
  • Posts: 1556
    • http://www.notonebit.com
Re: JavaScript pop up
« Reply #3 on: August 14, 2008, 08:14:39 AM »
Oh, so you know what it is that needs to be done and you're just not sure of the correct JS to do it? You seem to have a firm grasp on the basics with the onunload and if/then.
Even a broken clock is right twice a day.
NotOneBit.com
MCSE - MCSA - MCP (<- unused since 2006!)

Offline Alston

  • Spaceship Navigator
  • *****
  • Posts: 88
  • CT Insurance Agent
    • Connecticut Health Insurance Brokers
Re: JavaScript pop up
« Reply #4 on: August 14, 2008, 09:09:41 AM »
I'm pretty good with PHP, so I understand conceptually what needs to be done.  I'm just starting to learn JS and not sure what can and can't be done with it.

By the way, although a broken clock is right twice a day, one that is merely set to the wrong time is always wrong!