I've written this code to display a different song title (and link) each day of the week. But I want to put it all in an external .js file. The only problem is I don't know how to display it then when I finally get to the body tag. Please help me.
//Sets the array and its contents
var song = new Array(7);
song[0] = "<a href='http://www.redhotchilipeppers.com/'>Red Hot Chili Peppers - Aeroplane</a>";
song[2] = "<a href='http://www.sonymusic.com/artists/Fugees/'>The Fugees - Killing Me Softly</a>";
song[3] = "<a href='http://www.santana.com/'>Santana - Love Of My Life</a>";
song[4] = "<a href='http://www.lunanegra.com/www/ol_main.htm'>Ottmar Liebert - Surrender 2 Love</a>";
song[5] = "<a href='http://www.garyjules.com/'>Gary Jules - Mad World</a>";
song[6] = "<a href='http://www.disturbed1.com/'>Disturbed - Remember</a>";
song[7] = "<a href='http://www.jimi-hendrix.com/'>Jimi Hendrix - Foxy Lady</a>";
//Figures the day
var day = new Date();
<body>
I'd like song title here:
document.write(song[day.getDay()]);
</body>
Does anyone understand this at all? Is there anyone that can help me?
//Sets the array and its contents
var song = new Array(7);
song[0] = "<a href='http://www.redhotchilipeppers.com/'>Red Hot Chili Peppers - Aeroplane</a>";
song[2] = "<a href='http://www.sonymusic.com/artists/Fugees/'>The Fugees - Killing Me Softly</a>";
song[3] = "<a href='http://www.santana.com/'>Santana - Love Of My Life</a>";
song[4] = "<a href='http://www.lunanegra.com/www/ol_main.htm'>Ottmar Liebert - Surrender 2 Love</a>";
song[5] = "<a href='http://www.garyjules.com/'>Gary Jules - Mad World</a>";
song[6] = "<a href='http://www.disturbed1.com/'>Disturbed - Remember</a>";
song[7] = "<a href='http://www.jimi-hendrix.com/'>Jimi Hendrix - Foxy Lady</a>";
//Figures the day
var day = new Date();
<body>
I'd like song title here:
document.write(song[day.getDay()]);
</body>
Does anyone understand this at all? Is there anyone that can help me?