free hosting   image hosting   hosting reseller   online album   e-shop   famous people 
Free Website Templates
Free Installer

MIDI Menu


This is a simple MIDI jukebox from The Javascript Source.

It uses a dropdown menu for song selection.

When an item is clicked, the desired song is played in the background.

This script is suitable for IE and NS, using the appropriate coding for each browser.


Paste the code below in the head section of your page:
And paste the code below in the body section of your page:



How It Works

HEAD code:

The songs are stored in the songNum array. You can add as many as you like.

The default status loads the null track, #

Next, a check is performed to see if the browser is IE or NS.

Then the authorized MIDI plugin for each browser is accessed.

The function chooseSong loads the selection accessed from the menu.

If the browser is IE, the document.all commands outputs the desired track.

If the browser is NS, the function songPlay is called.

This does a further check to see that the NS plugin is LiveAudio.

If so, the music will play using the document.musicSource command.

Otherwise, an error alert popup will appear.

BODY code:

This is a standard dropdown menu form, plus a Play button.

Whichever menu item is selected is passed to the chooseSong function for playback.

The Play button is included to allow the user to replay the current selection when it is finished.

The script section writes the selected MIDI file to the page.

With IE, it uses Microsoft's bgsound command.

With NS, it uses the standard embed command.

The LiveAudio MASTERSOUND option is included in the EMBED tag.

This allows the plugin to be controlled by Javascript - in this case, the replay function.

If this option were not included, the button would not function.

To stop the music at any time, simply click on the Click for Music option.


Try It Out






© 2001 CyberSchool
Last Update: