#fcleft">




A lot of people use this script on their pages so their viewers could hear some soothing music while on the page. I, at first, didn't think this needed to be put on my Javascript Page, but I changed my mind after a few e-mails asking me for help because they didn't have a reliable random MIDI script. Although this isn't the shortest midi player around, it's probably the most reliable. This random MIDI player allows you to also put in MIDIs and WAVs.
The source...


<script language="Javascript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

var currentdate = 0
var theranmidi = " "
var core = 0

function StringArray (n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '

  }
}

midi = new StringArray(10)
midi[0] = 'america.mid'
midi[1] = 'cannon_d.mid'
midi[2] = 'entrtanr.mid'
midi[3] = 'hellomyb.mid'
midi[4] = 'maplerag.mid'
midi[5] = 'minwltz.mid'
midi[6] = 'mood2.mid'
midi[7] = 'prelude3.mid'
midi[8] = 'saintsgo.mid'
midi[9] = 'pete_wlf.mid'

ran = 60 / midi.length
 
function ranmidi() {
  currentdate = new Date()
  core = currentdate.getSeconds()
  adcore = Math.floor(core/ran)
  core = adcore
    theranmidi = midi[core]
    return (theranmidi)
}

document.write("A random MIDI: <b>"+ranmidi()+"</b><br><br>"
+"<EMBED src="+ranmidi()+" Width=200 Height=55 autostart=true>")

//-->
</script>


Main Page