Random Midi Player

This is my random midi player. There may be an easier way to write one, but this best suited the Lair's needs at the time I cobbled it together. Really.

Our goal (click it!):
Stuff in blue must be changed, stuff in this color can be changed if desired. The first section will be placed in the html page that will open as the midi player. The script can go between the <BODY> and </BODY> tags.

/* This JavaScript was composed by Kristin J. Johnson.
*The Wererat's Lair: https://wererat.net/ */
var nummidi = 4
day = new Date();
seed = day.getTime();
ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*nummidi + 1,10);

if (ran == (1)){
title=("Midi 1")

if (ran == (2)){
title=("Midi 2")

if (ran == (3)){
title=("Midi 3")

if (ran == (4)){
title=("Midi 4")

document.write("<META HTTP-EQUIV=REFRESH CONTENT='" + leng + "; URL=midiplayer.htm'>");
document.write("<EMBED SRC='"+ midi +"' AUTOSTART='true' LOOP='true' VOLUME=75 WIDTH=16 HEIGHT=16> <BR> ");
document.write("<FONT SIZE=-1>" + title + "</FONT> ");

leng is the length of the midi in seconds. midiplayer.htm must be changed to whatever you are naming the page that has the above JavaScript on. Note that it shows up in the form below also, so it's a good idea to replace both with the same HTML page name.

<INPUT TYPE="reset" VALUE="My Midi Player" ONCLICK="window.open('midiplayer.htm','Midis','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=200,height=25')">

This second bit of code gets placed on the page that the random midi player will be activated from (sorry about the font size, but wrapping the code in the example can add unexpected results when you copy and paste it).

See the word 'Midis' in the form above? That names the window that the player will open in. You can name it anything you want, but if you want to have more than one set of midis, keep the same name for both. If you give each a different name, you will get extra windows with dueling midi players.

Grab a text file of this JavaScript and form (right-click and save it as a text file).