Results 1 to 7 of 7

Thread: DHTML Modal Window

  1. #1
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default DHTML Modal Window

    1) Script Title: DHTML Modal window v1.01

    2) Script URL (on DD): http://dynamicdrive.com/dynamicindex...dhtmlmodal.htm

    3) Describe problem: Is there a way to make this cool script open when
    someone leaves the page? I have seen one that even works when you move your mouse to close.

    Thanks in advance for your help.

    Terry

  2. #2
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To open, say the example newsletter modal window on the script page, you could put as you <body> tag

    Code:
    <body onunload="getemail=dhtmlmodal.open('newsletterbox', 'div', 'emaildiv', 'Sign up for our Newsletter', 'width=400px,height=300px,center=1,resize=0,scrolling=1');">

  3. #3
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the reply.

    But, what I am wanting to do is NOT have the window open when
    someone arrives at site. I want it to open when they leave or move
    mouse to close window. I have seen this somewhere before, but
    cannot remember where...

    May be impossible for Modal Window, but thought I would ask about it.

    Thanks again,

    Terry

  4. #4
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you will notice, the javascript call is for body onunload... not onload...

    should work

  5. #5
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Opps. That does make a difference.

    I will give that a try. Really appreciate the help.

    Terry

  6. #6
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    There is a problem with your logic though- while you can get the DHTML modal window to popup only when the user leaves the page, it won't be seen, as the modal window is actually part of the page itself, despite its appearance.

    You'll need to use a regular popup window script to have it show up after the user has left the page, though the problem with that is that most pop up blockers probably will catch it.

  7. #7
    Join Date
    Jul 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You could use it in conjunction with something like this to prevent the user from actually leaving the page until they click some confirmation button inside your modal window.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •