There's a couple of new useful things in this script.
First is new Array.
var song=new Array;
song[1]="https://members.tripod.com/~grizzlyA/music/rbow.mid";
This makes it so I can assign a bunch of values to the array and be able to access it later according to the number.
So in my script I have 6 MIDI addresses stored in the array. I also have the title of the MIDI's store in an array
var title=new Array;
title[1]="rainbow connection";
So now I have 6 MIDI addresses and 6 titles stored in Arrays. Now all I need is a random number between 1 and 6 to pick wich MIDI will be played.
var pl=(Math.random(1));
This assigns a random number to the variable pl. The random number is less than 1 so now we'll multiply it by 6
pl=pl*6;
Now you need to round it off with this
pl=(Math.round(pl));
Now you should have a random number somewhere between 1 and 6. But if the original random number was real small you might end up with a zero wich we havn't assigned anything to song[0] or title[0] wich we could have so now we must make sure pl does not equal zero.
if (pl<1){pl=1;}
so if pl is smaller than one then pl will equal one. Now we have the number and use the location statement
location=song[pl];
and then writing the title to the page.
document.writeln("<center>You are listening to "+title[pl]+"</center>");
I could have place this script with in a function to be called when the page is loaded. Here is how you have a function called upon loading of a page.