Click to See Complete Forum and Search --> : Date & Office Hours Array
sooners95
09-25-2003, 10:42 PM
I would like to have a script that I can update each month for our Girl Scouts office hours like I saw in the upper right hand corner of this web page: http://www.library.drexel.edu but I'm not sure how to make it work for our own site. We will also have a random array of pictures on the page and that code can be seen in attached text file. Can someone give me some guidance about how do to this?
Thanks!
Katie
Khalid Ali
09-25-2003, 11:21 PM
can you elaborate a bit more that what is it you wanted to do???
sooners95
09-25-2003, 11:27 PM
I would like it to show the current date and the hours that the office is open that day. Here are our office hours:
Mondays: 8:30 am -- 5:30 pm
Tuesdays & Thursdays: 8:30 am – 5:30 pm
Fridays: 8:30 am – 12:30 pm
Saturday & Sundays -- CLOSED
So for example, on Sept. 26th it would say
Center Hours
September 26, 2003
Open 8:30 am - 12:30 pm
Thanks!
Katie
Khalid Ali
09-26-2003, 04:04 AM
There you go, a complete working example,you can set the class
.biz_hours properties according your requirement, such as location on the page etc.
<style type="text/css">
.biz_hours{
display:table-cell;width:160px;height:50px;background-color:blue;color:white;font-weight:bold;font-size:11px;padding-left:4px;
}
</style>
<script type="text/javascript">
<!--
Date.MONTHS = new Array("January","February","March","April",
"May","June","July","August",
"September","October","November","December");
Date.prototype.getRegularDate = function(){
return (Date.MONTHS[this.getMonth()]) + " "+
this.getDate() + ", " +
this.getFullYear();
}
function getBusinessHours(day){
if(day<5 && day>0){//monday - thru- thursday
return "Open 8:30 am -- 5:30 pm";
}else if (day==5){//friday
return "Open 8:30 am -- 12:30 pm";
}else if(day==6 | day ==0) {//saturday & sunday
return "CLOSED";
}else{
return "Wrong date parameter.";
}
}
function PrintBizHours(){
var date = new Date();
var div_biz_hrs = document.getElementById("div_biz_hours");
var htmlStr = "Center Hours<br/>"+
date.getRegularDate()+"<br/>"+
getBusinessHours(date.getDay());
div_biz_hrs.innerHTML = htmlStr;
}
//-->
</script>
</head>
<body class="body" onload="PrintBizHours();" >
<div id="div_biz_hours" class="biz_hours">
</div>