HighDots Forums  

html and time of day

alt.discuss.html alt.discuss.html


Discuss html and time of day in the alt.discuss.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rick Merrill
 
Posts: n/a

Default html and time of day - 01-12-2008 , 09:24 AM






I want to publish a TV schedule and would like to
have the page 'jump' to the current hour.

Is there any way for HTML to access the time of day?
(then goto a tag)

Reply With Quote
  #2  
Old   
Rick Merrill
 
Posts: n/a

Default 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>

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.