1st Site Free HTML Code (Cont.)

Random Midi


To begin, download at least 3 midi files from Google search engine, midi+files. Select at least three Midi files and copy these files in the same directory on your PC.

Next, create a blank HTML document and place it in the same directory.

Copy the following Javascript and paste it between the <head> </head> Tags of the HTML document you created.

<script>
<!-- //By George Chiang (http://www.freewarejava.com/)
More JavaScripts here!
var sound1="woeisme.mid"
var sound2="645jazz.mid"
var sound3="echoes.mid"
var x=Math.random()*10
if (x<=3) x=sound1
else if (x<=6) x=sound2
else
x=sound3
if (navigator.appName=="Microsoft Internet Explorer")
document.write('<bgsound src='+'"'+x+'"'+' loop="infinite">')
else
document.write('<embed src='+'"'+x+'"'+'hidden="true" border="0" width="20" height="20" autostart="true" loop="false">')
//-->
</script>

Change my Midi file names: woeisme.mid, 645jazz.mid and echoes.mid to match your Midi file names.

You can add as many sound files to this script as you want.

If you are new to JavaScript, I recommend you learn from an expert. Visit Introduction to JavaScript from W3schools.com.

Do You Need Help? Don't be shy, if you have questions or need help creating your Website, just ask me. I work cheap -- free. The only dumb question is the one not asked!

If you find this Website useful, donate as little as a $1.00 through the Amazon Honor System to help me keep it free. Paying is fast and easy: just click the Pay now button to begin. Your credit card is secure. Your privacy is protected.


Return to top
Help me improve this page, please provide me your
suggestions or recommend a free resource:

Suggestion or free resource


Back
Back



| Home | Plan | Design | Code | Upload | Test | Promote | Maintain |
| Search | Map | About this site | Privacy | Glossary | What's new? |


URL: http://www.1stsitefree.com/random-midi.htm

Bill Green
Copyright © 2001 - 2008