Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sounds simple but I'm stumped!!

Status
Not open for further replies.

waidc

Technical User
Mar 7, 2001
23
0
0
NZ
I'm trying to make a banner for an intranet page which updates dynamically, i.e. the page reads 'Today is...' and the javascript looks at the computer's date and fills in the details of 'Friday 2 August'. - This part is working great!!

The bit I want to add is which day of the school timetable calendar it is...we work on a system of five days that rotate consecutively, except for Wednesday which is always Day 6.

So a typical school fortnight could be - Monday (1), Tuesday (2), Wednesday (6), Thursday (3), Friday (4), Monday (5), Tuesday (1), Wednesday (6), Thursday (2), Friday (3). Like so...

Is there any way to add the javascript so that once the first day is set, all other days will follow on with their correct timetable day displayed??

I want the final banner to read:

Today is Friday August 2 - Day 3

like that. Many thanks for any replies in advance. :)
 
You could add a script that increments the schoolDay variable daily and perhaps an 'if' statement that checks to see if it is Wednesday or not (and then supplies the 6 interupting the normal increment.). You would also need a check to reset the schoolDay variable after it reaches 5.

If you need more info let me know.

jaxon
 
can you post your javascript that handles the date and I will see if I can modify it to incorporate what you want Tony
reddot.gif WIDTH=400 HEIGHT=2 VSPACE=3

 
jaxon & tony, thank you very much for your replies. The code I am using thus far is below:

<html>
<head>
<title>Day Script</title>
</head>
<body>
<p><font face=&quot;Georgia&quot; size=&quot;3&quot;><b>Today is
<SCRIPT LANGUAGE = 'JavaScript'>
<!--
function makeArray() {
for (i = 0; i<makeArray.arguments.length; i++)
this[i + 1] = makeArray.arguments;
}

function makeArray0() {
for (i = 0; i<makeArray0.arguments.length; i++)
this = makeArray0.arguments;
}

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var months = new

makeArray('January','February','March','April','May','June','July','August','September','October','November','December');
var days = new makeArray0('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

var today = new Date();
var day = days[today.getDay()];
var date = today.getDate();
var month = today.getMonth() + 1;
var year = y2k(today.getYear());

document.write(day + ' ' + date + ' ' + months[month]);

-->
</SCRIPT> - Day (this is where I want the day to go)</b></font>
</body>
</html>

Thanks again if you can help me with a solution for this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top