I am trying to make a page choose a random music selection and then play it...
I use this as the random function...
function get_random()
{
var ranNum= Math.round(Math.random()*10);
return ranNum;
}
I use this to select the music being played...
function getsong()
{
var songnum=get_random();
var song=new Array(10)
song[0]="james_bond_theme.mid";
song[1]="her_majestys.mid";
song[2]="tomorrow_never_dies.mid";
song[3]="for_your_eyes_only.mid";
song[4]="goldeneye.mid";
song[5]="you_only_live_twice.mid";
song[6]="a_view_to_a_kill.mid";
song[7]="goldfinger.mid";
song[8]="live_n_let_die.mid";
song[9]="spy_who_loved_me.mid";
return(song[songnum]);
Finally, I try to play it using
<EMBED SRC=getsong() AUTOSTART="TRUE" HIDDEN="TRUE" LOOP="TRUE"> <NOEMBED>
<BGSOUND ID="sound" LOOP="INFINITE"> </NOEMBED>
However, this doesn't play any music at all. I've tried putting quotes around the getsong(), but that doesn't work either. Can someone please quickly check through my code and see if they find any errors?
I use this as the random function...
function get_random()
{
var ranNum= Math.round(Math.random()*10);
return ranNum;
}
I use this to select the music being played...
function getsong()
{
var songnum=get_random();
var song=new Array(10)
song[0]="james_bond_theme.mid";
song[1]="her_majestys.mid";
song[2]="tomorrow_never_dies.mid";
song[3]="for_your_eyes_only.mid";
song[4]="goldeneye.mid";
song[5]="you_only_live_twice.mid";
song[6]="a_view_to_a_kill.mid";
song[7]="goldfinger.mid";
song[8]="live_n_let_die.mid";
song[9]="spy_who_loved_me.mid";
return(song[songnum]);
Finally, I try to play it using
<EMBED SRC=getsong() AUTOSTART="TRUE" HIDDEN="TRUE" LOOP="TRUE"> <NOEMBED>
<BGSOUND ID="sound" LOOP="INFINITE"> </NOEMBED>
However, this doesn't play any music at all. I've tried putting quotes around the getsong(), but that doesn't work either. Can someone please quickly check through my code and see if they find any errors?