<script type = "text/javascript">
var GMToffset = -5; // Your current GMT offset, whether Standard or Daylight style="font-size: large;"
var now = new Date();
var dy = now.getDay(); // day of week 0-6
var themonth=now.getMonth()+1;
var thetoday=now.getDate();
var thedow = now.getDay();
var hh = now.getHours();
var theminutes = now.getMinutes();
function GetDay(intDay){
var DayArray = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
return DayArray[intDay];
}
now.setHours( now.getHours() ); // GMToffset + + now.getTimezoneOffset() / 60
var show = "No Lab Assistant on duty<br><br> " + GetDay(thedow) + " " + themonth + "/" + thetoday + " " + hh +":"+ theminutes ;
// The GMT offset ensures that every visitor, regardless of their timezone, will see the schedule
// that is appropriate for the site owner's local time.
// Tip - for testing purposes you can put here
//dy = 3;
//hh = 7;
// or whatever to check that the right show appears at that day/time.
// days in Javascript are 0 Sunday - 6 Saturday
if (dy == 1 ) {
if (hh >=6 && hh <9) {show = "test<br>(856) 123-4567<br>email@cua.edu "; }
}
if (dy == 2 ) { // 2 Tuesday
if (hh >=6 && hh <9) {show = "test<br>(856) 123-4567<br>email@cua.edu "; }
}
if (dy == 3 || dy == 4 ) { // 2 Tuesday
if (hh >=6 && hh <9) {show = "<p>test<br>123-4567<br>email@cua.edu </p> "; }
}
if (dy == 6) { // Saturday Note the two = signs to mean equals
if (hh >=13 && hh <18) {show = "<p>test<br>123-4567<br>email@cua.edu </p> "; }
} //End of Saturday Shows
if (dy == 0) { //Sunday Shows
if (hh >=13 && hh <18) {show = "<p>test<br>123-4567<br>email@cua.edu </p> "; }
} // End of Sunday Shows
var a = "<em>" + show + " \u00A0 \u00A0 \u00A0 \u00A0 <em> " ; // spaces must be separted by Unicode spaces to prevent collapse + hh + " " + dy
//document.getElementById("dj").innerHTML = a;
document.write(a);
</script>
No comments:
Post a Comment