URL Redirect Based on the Day of the Week

You would have seen a certain page based on the day of the week if the link was valid. all you need to do is change the window.locations to your own links.

Put this in the head of your document:

<script>
<!--

function initArray()
{
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++)
this[i+1] = initArray.arguments[i];
}

var DOWArray = new
initArray("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday");
var today = new Date();
var day = DOWArray[today.getDay()];
alert("Today is " + day + "! If the file " + day + ".html had existed, you would have been taken there.")
if (day == "Monday") window.location = "Monday.html"
if (day == "Tuesday") window.location = "Tuesday.html"
if (day == "Wednesday") window.location = "Wednesday.html"
if (day == "Thursday") window.location = "Thursday.html"
if (day == "Friday") window.location = "Friday.html"
if (day == "Saturday") window.location = "Saturday.html"
if (day == "Sunday") window.location = "Sunday.html"

//-->

</script>


redirect day of the week javascript


Back To Top
© 1998 - 2014 psacake.com | My3C's

Version 7.0a | Advertise on this site