auto close lightbox with javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
madmega
Forum Newbie
Posts: 10
Joined: Sat Dec 26, 2009 5:23 pm

auto close lightbox with javascript

Post by madmega »

Hi, i am loading a form in a lightbox (thickbox), if the form is filled in, than another window is opened, where a javascript is running in that has to close the active window.
Originally it was written for a pop-up window to auto close it.
Now that i am loading that into a lightbox, it doesn't work anymore, it is counting down but not closing the lightbox.
Here is the code:

Code: Select all

<HTML>
<title>Bestel Formulier</title>
 
<body background="files/v3_box_bg.gif" link=#E2E965 vlink=#E2E965 alink=#E2E965>
<font size=4 color=#669900><b><center>Dank u voor u vraag.</b></center></font>
 
 	<style type="text/css"> 
input { 
border: 0px;
}
</style>
 
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
	start=Date.parse(start)/1000;
	var counts=5;
	function CountDown(){
		var now=new Date();
		now=Date.parse(now)/1000;
		var x=parseInt(counts-(now-start),10);
		if(document.form1){document.form1.clock.value = x;}
		if(x>
0){
			timerID=setTimeout("CountDown()", 100)
		}else{
			timer=setTimeout("window.close()",100)
		}
	}
//  End -->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</script>
</HEAD>
<BODY>
 
</script>
<center>
<br>
<br>
<FORM NAME="form1">
Dit venster sluit vanzelf in <INPUT type="text" name="clock" SIZE="1" style="background-image: url(files/v3_box_bg.gif);">seconden.
</FORM>
</body>
</html>
 
Post Reply