Forum Moderators: open

Message Too Old, No Replies

Have you seen a script that will .

         

Jami

2:09 am on Apr 14, 2006 (gmt 0)

10+ Year Member



Hello,

I'm looking for a DIV & javascript that will hide html content based on a set date.

I see a lot of things that come close here at this forum, but are more complex and don't run based on date. So maybe someone has a modification....

Thanks for your help!

Fotiman

4:00 pm on Apr 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Maybe something like this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset:utf-8">
<title></title>
<script type="text/javascript">
// Hide on April 14th, 2006
var xYear = 2006;
var xMon = 3; // Jan = 0, Feb = 1, Mar = 2, Apr = 3, etc.
var xDate = 14;
// End of configuration.
function hideOnDate( idref )
{
// TODO: make sure browser supports getElementById
var el = document.getElementById(idref);
// TODO: make sure el was found
var today = new Date();
if( xYear!= today.getFullYear() ) return;
if( xMon!= today.getMonth() ) return;
if( xDate!= today.getDate() ) return;
// If we're still here, the dates match, so hide it
el.style.display = "none";
}
</script>
</head>
<body onload="hideOnDate('foo');">
<div id="foo">
Sorry, today is not April 14th, 2006. :(
</div>
</body>
</html>