Hi,

Im looking for the basic structure of how to make a piece of code (ideally a lightbox window with a flash file being displayed) but for now maybe a popup window, to be displayed at 12:00pm each day automatically.

Can anyone help me with this task? Give me a pointer in the right direction ? (I dont know too much Javascript though)..

Any help will be much appreciated..

Thanks alot,
Chris

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
var timerid = 0;
function startTime()
{
	if(timerid)
	{
		clearTimeout(timerid);
	}
	var tDate = new Date();
	if(tDate.getHours() == "12" && tDate.getMinutes() == "00" && tDate.getSeconds() == "00")
	{
		window.open("http://daniweb.com","Window1","menubar=no,width=430,height=360,toolbar=no");
	}
	
	timerid = setTimeout("startTime()", 1000);
}
</script>
</head>

<body onload="startTime();">
</body>
</html>

hi,

can u please explain me why you use this piece of code:

if(timerid)	{	
          clearTimeout(timerid);
}

Thanks

oops, this is suppose to be at line 12: timerid = 0;
it keeps the id from getting so large since I assume the page is going to be up for a while.

and this doesn't actually need to be there: clearTimeout(timerid);
I actually pulled script from a different function that had other functions calling it as well and I accidentally left it in there, it serves no purpose here.

thx,

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
var timerid = 0;
function startTime()
{
	if(timerid)
	{
                timerid = 0;
	}
	var tDate = new Date();
	if(tDate.getHours() == "12" && tDate.getMinutes() == "00" && tDate.getSeconds() == "00")
	{
		window.open("http://daniweb.com","Window1","menubar=no,width=430,height=360,toolbar=no");
	}
	
	timerid = setTimeout("startTime()", 1000);
}
</script>
</head>

<body onload="startTime();">
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.