Why do you want it to be random? In that case you will need to use a cookie to store the random article in the user's computer so that the same article will be displayed throughout the whole week.
It would be simpler (and perhaps more effective) just to display a random article each time the user visited your site.
If you want every user to see the
same article then there is no random element involved.
This code will display a quotation based on the week number. You can easily adapt it for your requirements. Of course, while you must have 53 "quotations" (links) these can be duplicated, and arranged so as to
appear to be random.
Code:
<div id = "quoteOfWeek"></div>
<script type = "text/javascript">
Date.prototype.getWeek = function() {
var onejan = new Date(this.getFullYear(),0,1); // month 0 is January
return Math.ceil((((this - onejan) / 86400000) + onejan.getDay()+1)/7);
}
var today = new Date();
var weekno = today.getWeek();
var Quotation = [];
Quotation[1] = "Sanity is a golden apple with no shoelaces.";
Quotation[2] = "Repent! The end is coming, $9.95 at Amazon.";
Quotation[3] = "Honesty blurts where deception sneezes.";
Quotation[4] = "Pastry satisfies where art is unavailable.";
Quotation[5] = "Delete not, lest you, too, be deleted.";
Quotation[6] = "O! Youth! What a pain in the backside.";
Quotation[7] = "Wishes are like goldfish with propellors.";
Quotation[8] = "Love the river's \"beauty\", but live on a hill."; // note escape quotes
Quotation[9] = "Invention is the mother of too many useless toys.";
Quotation[10] = "Time is of the essence! Comb your hair.";
// and so on for 53 weeks
document.getElementById("quoteOfWeek").innerHTML=Quotation[weekno];
</script>