Jump to content

ramig

Members
  • Posts

    2
  • Joined

  • Last visited

ramig's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Here is the code:<html><head></head><body onload = "show()"><div id = "mymessage">No message at the present time</div><script type = "text/javascript">function show() {var nowhrs = new Date().getHours();var nowmins = new Date().getMinutes();var hrsmins = nowhrs + (nowmins/60); // decimals of an hourvar schedule = [['Message 1',[9],[18]], // times are expressed as hours + decimals of an hour, e.g. 30 minutes is .5 hours.['Message 2',[18],[21.5]],['Message 3',[19.5],[20.25]]]var themessage = "";for (var i =0; i <schedule.length; i++) {if ((hrsmins >= schedule[1]) && (hrsmins < schedule[2])) {themessage += schedule[0] + "<br>";document.getElementById("mymessage").innerHTML = themessage;}}}</script></body></html>
  2. Is there anyone that write me a javascript code that will display a certain message based on what time of day it is and what day of the week it is. I run a radio stations website and they want to put up a schedule of their on-air staff and shows on their website.Here is a code i found that worked, but it's just time in general, not what day of the week. Also, how can I make it to get the time in a certain time zone? No message at the present timefunction show() {var nowhrs = new Date().getHours();var nowmins = new Date().getMinutes();var hrsmins = nowhrs + (nowmins/60); // decimals of an hourvar schedule = [['Message 1',[9],[18]], // times are expressed as hours + decimals of an hour, e.g. 30 minutes is .5 hours.['Message 2',[18],[21.5]],['Message 3',[19.5],[20.25]]]var themessage = "";for (var i =0; i = schedule[i][1]) && (hrsmins < schedule[i][2])) {themessage += schedule[i][0] + "";document.getElementById("mymessage").innerHTML = themessage;}}}
×
×
  • Create New...