I'm trying to show hide divs based on date and am experimenting with the following code:
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script>
window.setInterval(function(){
var current = new Date();
var expiry = new Date("October 29, 2012 12:00:00")
var expiry2 = new Date("October 30, 2012 12:00:00")
if(current.getTime()>expiry.getTime()){
$('#one').hide();
$('#two').show();
}
else(current.getTime()>expiry2.getTime()){
$('#two').hide();
$('#three').show();
}
}, 3000);
$('#one').show();
</script>
<div id="one" style="display:none">
<p>content for div #one</p>
</div>
<div id="two" style="display:none">
<p>content for div #two</p>
</div>
<div id="three" style="display:none">
<p>content for div three</p>
</div>
Console in chrome is throwing up :
Unexpected token {
So it seems there's a syntax error with the if else statement, but it looks ok to me : (
Can any one spot what I'm missing?