effects due to the usage of this script or any derivative.
No warrantees for usability for any specific application
are given or implied.
You are free to use and modify this script,
if all credits are kept in the source code
*/
function GetTodaysURL()
{
// Put relative or full URL's in the strings below
// First line is returned on Mondays, second on Tuesdays ...
// ... and the seventh on Sundays
var locationlist = new URLList
(
"groucho.html", // Monday
"harpo.html", // Tuesday
"zeppo.html",
"chico.html",
"harpo.html",
"groucho.html",
"chico.html" // Sunday
);
now = new Date();
num = now.getDay();
if (num == 0)
num = 7;
location.href = locationlist.list[num-1];
}
function URLList ()
{
var argv = URLList.arguments;
var argc = argv.length;
this.list = new Object();
for (var i = 0; i < argc; i++)
this.list[i] = argv[i];
this.count = argc;
return this;
}
// -->
</script>
</head>
<body bgcolor="FFFFFF" text="000000">
<h1>JavaScript Today's Link</h1>
<p><b>This page contains a JavaScript that selects a different URL for each day of the
week</b></p>
<p>
This JavaScript lets you present a different link to a different document URL for each day of the week.</p>
<p>
You can use this to direct your readers to a different site each day of the week, or if you run a daily newsletter you can use it to let readers to go to a specific file depending on the day of the week.</p>
<p>
The script is named <b>GetTodaysURL</b> and it is placed in the HEAD section of the HTML document. The script is executed by clicking on a link containing a call to GetTodaysURL(). Also note the <font color="FF3366">custom text</font> in the browser's status area.</p>
<p>
Example of this script picking
<a href="javascript:GetTodaysURL()"
onMouseOver="window.status='This link takes you the page of the day!'; return true" onMouseOut="window.status=''">todays</a> page. Another page will be displayed tomorrow.
<p>
<b>How to use:</b><br>
Replace the filenames inside the script with your own URLs and edit this page contents inside the <BODY> section. (You can also copy the entire script to one of your existing pages).</p>
<pre>function GetTodaysURL()
{
// Put relative or full URL's in the strings below
// First line is returned on Mondays, second on Tuesdays ...
// ... and the seventh on Sundays
var locationlist = new URLList
(
"groucho.html", // Monday
"harpo.html", // Tuesday
"zeppo.html",
"chico.html",
"harpo.html",
"groucho.html",
"chico.html" // Sunday
);
</pre>
<p>Use code similar to this to let the user execute the script:</p>
<pre><A HREF="javascript:GetTodaysURL()"
onMouseOver="window.status='This link takes you the page of the day!'; return true" onMouseOut="window.status=''">Todays page</A>