PDA

View Full Version : Random midi script


freddymoo
08-26-2000, 07:40 PM
I have tried to put a midi script in my site but I'm not able to hear the music ! Can you help me? I don't know where is my mistake!

Here is the script:

<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] = 'midi1.mid'
midi[1] = 'midi2.mid'
midi[2] = 'midi3.mid'
midi[3] = 'midi4.mid'
midi[4] = 'midi5.mid'
midi[5] = 'midi6.mid'
midi[6] = 'midi7.mid'
midi[7] = 'midi8.mid'
midi[8] = 'midi9.mid'
midi[9] = 'midi10.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("RANDOM MIDI IS: <b>"+ranmidi()+"</b><br><br>"
+"<EMBED src="+ranmidi()+" Width=200 Height=55 autostart=true hidden=true>")

//-->
</script>

Doni FN
08-26-2000, 08:25 PM
make sure all the midi file names are matching and that they are in the same directory as the html file.

Would also help if you posted a url to the page.

Thanks Doni

------------------
Need Free Web Graphics?
http://www.freewebtemplates.com