PDA

View Full Version : DHTML Window widget - how to delay popup



shaunmacie
06-05-2007, 03:52 AM
1) Script Title: DHTML Window widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:

I am working on this script set up on my page in progress:
http://www.campuscalm.com/dhtml.html

I am looking to have the window load after about 15 seconds or so instead of loading immediately on pageload. The .JS file is really complex and I don't dare mess with something way beyond my level, so I am hoping someone can tell me what code could be included to create a delay. I think I need to use a command something like this: window.setTimeout("firePopup()", 15000); but I don't have any idea how to do it.

Any help would be greatly appreciated!

Thanks,
Shaun
http://www.dynamicdrive.com/forums/images/smilies/confused.gif

shaunmacie
06-05-2007, 03:07 PM
I did some more research and I think I'm on the right track, but it needs fine tuning because it still doesn't work. I added the function script for my window to delay 5 seconds, but either it not formatted correctly or it won't work this way, because it doesn't work as-is:



<link rel="stylesheet" href="dhtmlwindow/windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript">
function Delay()
{
setTimeout('popupwin', 5000);
}

</script>

<script type="text/javascript" src="dhtmlwindow/windowfiles/dhtmlwindow.js">

/***********************************************
* DHTML Window Widget- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

</head>

<body onload="Delay()" bgcolor="#7FC31C" topmargin="25">

<script type="text/javascript">
var popupwin=dhtmlwindow.open("signup", "ajax", "students.html", "Campus Calm Signup", "width=200px,height=350px,resize=0,scrolling=0,left=50px,top=50px", "recal");

</script>

shaunmacie
06-05-2007, 07:49 PM
I have a modified code that works in Safari, but doesn't work in IE or Firefox. Here it is:


<link rel="stylesheet" href="dhtmlwindow/windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript">
function Delay()
{
setTimeout('popupwin()',5000);
}

</script>

<script type="text/javascript" src="dhtmlwindow/windowfiles/dhtmlwindow.js">



/***********************************************
* DHTML Window Widget- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

</head>

<body onload="Delay()" bgcolor="#7FC31C" topmargin="25" onLoad="MM_preloadImages('campuscalmimages/calm_beginnings_on.gif','campuscalmimages/free_tips_on.gif','campuscalmimages/free_articles_on.gif','campuscalmimages/did_you_know_on.gif','campuscalmimages/calm_for_students_on.gif','campuscalmimages/educators_on.gif','campuscalmimages/products_on.gif','campuscalmimages/media_kit_on.gif','campuscalmimages/calm_perspectives_on.gif','campuscalmimages/sound_off_on.gif','campuscalmimages/blog_on.gif','campuscalmimages/contact_on.gif','campuscalmimages/parents_forum_on.gif')">

<script type="text/javascript">
var popupwin = function(){ dhtmlwindow.open("signup", "ajax", "students.html", "Campus Calm Signup", "width=200px,height=350px,resize=0,scrolling=0,left=50px,top=50px", "recal"); }

</script>

Here is the page that works in Safari:
http://www.campuscalm.com/dhtml2.html