PDA

View Full Version : Show/hide on Certain Dates



zbphill
08-04-2009, 09:11 PM
I'm looking for some kind of code to Show/hide based on dates.

So, a div will show 9/01/09 though 10/01/09 and show another after that.

Thanks

rainarts
08-05-2009, 01:19 AM
Hi,

You could try something like:

<script type="text/javascript">
<!--
onload = function() {
var today = new Date();
var month = (( today.getMonth() ) + 1 );

var date = today.getDate();

var div = document.getElementById("divID");

if ( month === 10 && date === 1 ) // Your preferred date settings.
div.style.display = "block";
else
div.style.display = "none";
};
// -->
</script>

bring this up inside the header section of your page.