PDA

View Full Version : Making marquee show different text on different date


kroesss
04-29-2003, 08:03 PM
Hello,

I'm trying to make the text scrolling through a default marquee (the one you make in frontpage) depending on the system-date. For example: From June 1st untill June 4th it should say text A and from June 5th till June 9th it should say text B.

I already have a marquee on the page I'm maintaining if you don't know what function I'm talking about.

www.peatminers.tk

A big thanks to anybody that can help me, this would really save me a lot of time.

Kroesss.

Tails
04-29-2003, 08:15 PM
<script>
D=Array(7)
D[0]='Sunday!'
D[1]='Monday!'
D[2]='Tuesday!'
D[3]='Wednesday!'
D[4]='Thursday!'
D[5]='Friday!'
D[6]='Saturday!'
document.write('<marquee><font size="+2">'+D[new Date().getDay()]+'</font></marquee>')
</script>

This will work for weekdays. If you want something for exact ranges in the month of june, what would you like to happen on the days after the 9th? Is this for a special event? Try using IF with new Date().getMonth() and newDate().getDate(). And use the < and > symbols with the && (I'll try to put a real example later when I have the time).

kroesss
04-30-2003, 09:27 AM
there isn't anything hapening on June 9th, I just put that in as an example. I use the marquee to announce the matchups that are going to be played by the different teams of our basketbalclub (the site is that of a small basketblclub I'm also playing in).

Basicly, I'm trying to get it to work like this:

In the beginning of the season, when all the games are planned, I want to alter the script, so that the page will automaticly display the next game though the season, in stead of me retyping and uploading the whole thing twice a week with a risk that I will forget doing so every once in a while.

I'll try to work something out based on your post, but if you have anything worked out, please post it here because I am a newbie in JavaScripting.

Thanks, Kroesss

kroesss
05-01-2003, 06:21 PM
Tails: Thanks a lot :thumbsup:

I managed to build a script that does exactly what I want it to do, based on your suggestions. I've just built my first JavaScript I guess.

Thanks a lot!

Kroesss

Tails
05-01-2003, 09:07 PM
Cool! You're the first person I've helped ^_^. All the other users here usually beat me to it. A victory for both. Thanks!