/    Sign up×
Community /Pin to ProfileBookmark

Random Link by Day of Week

I’m looking to create a table on my phpbb site where a different Link will appear according to the day of the week.
All I’ve been able to find is “redirect” programs, but that isn’t what I’m looking for.
We’re looking to devote each day on our forum to a different Theme, and would like that day’s theme to show a link for that day…such as Friday would be “Travel” day.

So, I’d like something like the following-
“Today is Friday. Our Special Theme today is- Travel”<—–(the link to our Travel Forum)

Any help is greatly appreciated!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@CharlesAug 13.2005 — &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta name="Content-Script-Type" content="text/javascript"&gt;
&lt;meta name="Content-Style-Type" content="text/css"&gt;
&lt;title&gt;Example&lt;/title&gt;

&lt;script type="text/javascript"&gt;
if (document.getElementById) onload = function () {
var e, i = 0;
var a = document.getElementById ('foo').getElementsByTagName ('LI');
while (e = a[i++]) {
e.className = 'hide';
}
a[new Date().getDay()].className = '';
}
&lt;/script&gt;

&lt;style type="text/css"&gt;
.hide {display:none}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;ul id="foo"&gt;
&lt;li&gt;Sunday&lt;/li&gt;
&lt;li&gt;Monday&lt;/li&gt;
&lt;li&gt;Tuesday&lt;/li&gt;
&lt;li&gt;Wednesday&lt;/li&gt;
&lt;li&gt;Thursday&lt;/li&gt;
&lt;li&gt;Friday&lt;/li&gt;
&lt;li&gt;Saturday&lt;/li&gt;
&lt;/ul&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@HeartlanderauthorAug 13.2005 — Now will that give me a simple group of text inside my table to read-

"Today is Friday. Our Featured Theme Today is- Travel"

...with the word Travel the only word that is linked in the line of text?

That is what I need, specifically.

No other text or links- just the above sentence.

Thanks.
Copy linkTweet thisAlerts:
@CharlesAug 13.2005 — 1) Do not use TABLEs for layout.

2) You need all options there in the mark up for those of us who do not use JavaScript.

3) My example, above, will hide the stuff for the other days in the week.

4) This way of doing things is way easier than dumping everything in the JavaScript.
Copy linkTweet thisAlerts:
@HeartlanderauthorAug 13.2005 — Did the required editing in the "Friday" part, and it works like a charm!

Thanks much!
×

Success!

Help @Heartlander spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...