Jump to content

Weekly rotating text


tretre34
 Share

Recommended Posts

I can think of many ways to do it, but they all require some form of storage, and Javascript can't store any information. You would need PHP or another server-side language. There is one way I could think of how to do it without some form of storage: Make an algorithm that returns a number based on the current week of the year. Since Javascript's Date() object doesn't return week numbers you will need to make a function to calculate that. Then you will need another function that selects a text based on that number. I think the modulo operator would work for that (%).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...