Re: html and time of day -
01-12-2008
, 01:33 PM
I can get the time of day from javascript..
<head>
<script type="text/javascript">
var thedate = new Date();
var dayofweek = thedate.getUTCDay();
var hourofday = thedate.getUTCHours();
function onAir()
{
// return TRUE if it's Mon through Sat, 3a-6a UTC
if (dayofweek != 0 &&
((hourofday > 2 && hourofday < 7))) {
return true;
}
return false;
}
</script>
</head><body>
<h1>The David Lawrence Show!</h1>
<script type="text/javascript">
if (onAir()) {
document.write("<h2>ON THE AIR</h2>");
} else {
document.write("<h2>OFF THE AIR</h2>");
}
</script>
<p>
If you want to learn more about David's show,
please visit
<a href="http://thedavidlawrenceshow.com/">The
David Lawrence Show</a>
</p>
</body>
</html> |