PDA

View Full Version : DHTML Modal Window



ccnetz
09-13-2007, 07:42 PM
1) Script Title: DHTML Modal window v1.01

2) Script URL (on DD): http://dynamicdrive.com/dynamicindex8/dhtmlwindow/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

jmctg
09-13-2007, 08:55 PM
To open, say the example newsletter modal window on the script page, you could put as you <body> tag



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

ccnetz
09-13-2007, 09:50 PM
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

jmctg
09-14-2007, 04:29 AM
If you will notice, the javascript call is for body onunload... not onload...

should work :)

ccnetz
09-14-2007, 04:38 AM
Opps. That does make a difference.

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

Terry

ddadmin
09-14-2007, 04:57 AM
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.

jmctg
09-14-2007, 05:06 AM
You could use it in conjunction with something like this (http://www.thescripts.com/forum/thread91541.html) to prevent the user from actually leaving the page until they click some confirmation button inside your modal window.