guys. I am currently making a website but I want to make so my site redirects to the day of the week automatically instead of needing to press the link. Example : If its monday the site will redirect to monday.html.
My code :
<!DOCTYPE -be sure to use one of these! 
<html> 
<head> 
<title></title> 
<script type="text/javascript"> 
window.onload = function(){chgDailyImg();} 
function chgDailyImg() 
{ 
var imagearray = new Array(); 
imagearray[0] = "sundaypic.png"; 
imagearray[1] = "mondaypic.png"; 
imagearray[2] = "tuesdaypic.png"; 
imagearray[3] = "wednesdaypic.png"; 
imagearray[4] = "assets/images/thursdaypic.png"; 
imagearray[5] = "fridaypic.png"; 
imagearray[6] = "saturdaypic.png";
var linkarray = new Array(); 
linkarray[0] = "sondag.html"; 
linkarray[1] = "mandag.html"; 
linkarray[2] = "tirsdag.html"; 
linkarray[3] = "onsdag.html"; 
linkarray[4] = "torsdag.html"; 
linkarray[5] = "fredag.html"; 
linkarray[6] = "lordag.html";
var textarray = new Array(); 
textarray[0] = "This is sunday's text - click to go to sunday's page"; 
textarray[1] = "This is monday's text - click to go to monday's page"; 
textarray[2] = "This is tuesday's text - click to go to tuesday's page"; 
textarray[3] = "This is wednesday's text - click to go to wednesday's page"; 
textarray[4] = "Torsdag"; 
textarray[5] = "This is friday's text - click to go to friday's page"; 
textarray[6] = "This is saturday's text - click to go to saturday's page";
var d = new Date(); /*** create a date object for use ***/ 
var i = d.getDay(); /*** use the date object to get the day of the week - this will be a number from 0 to 6 - sunday=0, saturday=6 -it's the way counting works in javascript it starts at 0 like in the arrays ***/ 
document.getElementById("dailyImg").src = imagearray[i]; 
document.getElementById("dailyLink").href = linkarray[i]; 
document.getElementById("dailyLink").innerHTML = textarray[i]; 
} 
</script> 
</head> 
<body> 
<div> 
<a href="sundaypage.html" id="dailyLink">This is sunday's text - click to go to sunday's page</a> 
<img src="sundaypic.jpg" alt="daily pic" title="daily pic" width="300" height="100" id="dailyImg" /> 
</div> 
</body> 
</html> 
     
     
    