Click to See Complete Forum and Search --> : Help! Midi Menu JavaScript
AleyLee
11-03-2003, 08:44 AM
Hi everyone! :)
I have just added the Midi Menu to my website and my question is this:
First, I use FrontPage to edit my site. The Midi Menu works when I "preview" my page in FrontPage Mode, but, after I uploaded to my URL - 012webpages, it wouldn't work. Can anyone help me to figure out why it won't work??
Thanks a bunch! :)
gil davis
11-03-2003, 09:09 AM
Not without a link. We read javascript, not minds.
AleyLee
11-03-2003, 10:59 AM
Originally posted by gil davis
Not without a link. We read javascript, not minds.
I'm not sure what you mean here. Care to elaborate a little?
AleyLee
11-03-2003, 11:21 AM
Here is the "original" Midi Menu Script:
<!-- TWO STEPS TO INSTALL MIDI MENU:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Nicholas Loar -->
<!-- Web Site: http://www.cass.net/~anarchy -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "http://javascript.internet.com/img/midi-menu/whiskey.mid";
songNum[2] = "http://javascript.internet.com/img/midi-menu/aeroplane.mid";
songNum[3] = "http://javascript.internet.com/img/midi-menu/christina.mid";
songNum[4] = "http://javascript.internet.com/img/midi-menu/hell.mid";
var music = null;
var track = 0;
var ver = navigator.appName;
function audioCheck(plugName) {
for (var i = 0; i < navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {
for (var j = 0; j < navigator.plugins[i].length; j++) {
if (navigator.plugins[i][j].enabledPlugin) {
return true;
}
}
return false;
}
}
return false;
}
function chooseSong(s) { // ie
track = s.options[s.selectedIndex].value;
if (ver == "Microsoft Internet Explorer") {
document.all.music.src = songNum[track];
} else {
songPlay('play');
}
}
function songPlay(cmd) { // netscape
if (audioCheck("LiveAudio")) {
if (cmd == 'play') {
document.musicSource.play(false, songNum[track]);
}
} else {
alert("You Do Not Have The Correct Plugin");
}
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form name=choose>
<select size=1 name=track onChange="chooseSong(this);">
<option value="0">Click For Music</option>
<option value="1">Whiskey In A Jar</option>
<option value="2">Aeroplane</option>
<option value="3">Genie In A Bottle</option>
<option value="4">Hell</option>
</select>
<input type=button onMouseDown="chooseSong(document.choose.track)" value=" Play ">
</form>
<script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="aeroplane.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
</center>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 2.53 KB -->
Now here is mine, on my index page:
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Nicholas Loar -->
<!-- Web Site: http://www.cass.net/~anarchy -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid";
songNum[2] = "http://rock.mididb.com/20030518/Bad_Company/Feel_Like_Makin_Love.mid";
songNum[3] = "http://rock.mididb.com/20030518/Cars/Lets_Go.mid";
songNum[4] = "http://rock.mididb.com/20030518/Dire_Straits/Walk_Of_Life.mid";
songNum[5] = "http://209.197.86.65/20030518/f/eagles/Already_Gone.mid";
songNum[6] = "http://rock.mididb.com/20030518/Guns_N_Roses/Knockin_On_Heavens_Door.mid";
songNum[7] = "http://rock.mididb.com/20030518/Guns_N_Roses/Sweet_Child_O_Mine.mid";
songNum[8] = "http://rock.mididb.com/20030518/Henley_Don/Boys_of_Summer.mid";
songNum[9] = "http://rock.mididb.com/20030518/Joplin_Janis/Piece_of_my_Heart.mid";
songNum[10] = "http://209.197.86.65/20030518/f/bryanadams/Cuts_Like_A_Knife.mid";
songNum[11] = "http://209.197.86.65/20030518/f/ledzep/DazedAndConfused.mid";
songNum[12] = "http://rock.mididb.com/20030518/ZZ_Top/Gimme_All_Your_Lovin.mid";
songNum[13] = "http://rock.mididb.com/20030518/Walsh_Joe/Rocky_Mountain_Way.mid";
songNum[14] = "http://rock.mididb.com/20030518/Van_Halen/Dance_the_Night_Away.mid";
songNum[15] = "http://209.197.86.65/20030518/f/u2/One.mid";
songNum[16] = "http://rock.mididb.com/20030518/Stewart_Rod/Do_Ya_Think_Im_Sexy.mid";
songNum[17] = "http://rock.mididb.com/20030518/Stewart_Rod/Maggie_May.mid";
songNum[18] = "http://rock.mididb.com/20030518/Stewart_Rod/Tonights_the_Night.mid";
songNum[19] = "http://rock.mididb.com/20030518/Rolling_Stones/Time_Is_on_my_Side.mid";
songNum[20] = "http://rock.mididb.com/20030518/Richard_Cliff/We_Dont_Talk_Anymore.mid";
songNum[21] = "http://rock.mididb.com/20030518/REO_Speedwagon/Take_It_on_the_Run.mid";
var music = null;
var track = 0;
var ver = navigator.appName;
function audioCheck(plugName) {
for (var i = 0; i < navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {
for (var j = 0; j < navigator.plugins[i].length; j++) {
if (navigator.plugins[i][j].enabledPlugin) {
return true;
}
}
return false;
}
}
return false;
}
function chooseSong(s) { // ie
track = s.options[s.selectedIndex].value;
if (ver == "Microsoft Internet Explorer") {
document.all.music.src = songNum[track];
} else {
songPlay('play');
}
}
function songPlay(cmd) { // netscape
if (audioCheck("LiveAudio")) {
if (cmd == 'play') {
document.musicSource.play(false, songNum[track]);
}
} else {
alert("You Do Not Have The Correct Plugin");
}
}
// End -->
</script></head>
<BODY>
<center>
<form name=choose>
<select size=1 name=track onChange="chooseSong(this);">
<option value="0">Click For Music</option>
<option value="1">Running On Empty</option>
<option value="2">Feel Like Makin Love</option>
<option value="3">Let's Go</option>
<option value="4">Walk Of Life</option>
<option value="5">Already Gone</option>
<option value="6">Knockin On Heavens Door</option>
<option value="7">Sweet Child O Mine</option>
<option value="8">Boys of Summer</option>
<option value="9">Piece of my Heart</option>
<option value="10">Cuts Like A Knife</option>
<option value="11">Dazed And Confused</option>
<option value="12">Gimme All Your Lovin</option>
<option value="13">Rocky Mountain Way</option>
<option value="14">Dance The Night Away</option>
<option value="15">One</option>
<option value="16">Do Ya Think Im Sexy</option>
<option value="17">Maggie May</option>
<option value="18">Tonights the Night</option>
<option value="19">Time Is on my Side</option>
<option value="20">We Dont Talk Anymore</option>
<option value="21">Take It on the Run</option>
</select>
<input type=button onMouseDown="chooseSong(document.choose.track)" value=" Play ">
</form>
<script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="aeroplane.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
The only difference in these scripts are the songs. With FrontPage 2002, you have 3 modes - Normal/HTML/Preview. When I preview my page, the songs will play.
Now that I uploaded my page to my server and I click on a song, nothing happens; no error message... just nothing.
AleyLee
11-03-2003, 10:01 PM
Hi.. just wanted to put this post back to the beginning because I really really need help with this one! :confused:
Computerman45
11-06-2003, 04:54 PM
This right here is your problem.. in the last part it says:
<script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="aeroplane.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
It should look like this:
script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
AleyLee
11-06-2003, 11:22 PM
Thank You Computerman45! One question though...
How will it work will ALL of the songs, and not just Running_On_Empty?
Thanks Again for your help! :-)
Computerman45
11-07-2003, 07:34 AM
It should have a pull down menu allowing you to change the song. I have used this script before and in the edited part I showed you, you have to use the a song name from the list. The others should work when you pull down the menu.
AleyLee
11-07-2003, 09:18 AM
It still won't work!:( ...:mad:
I dont know... I'm about ready to give up!
I tried other methods too:
script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#Click For Music" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#Click For Music" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#1" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
There's more that I tried including the top part of the script.
this is all so frustrating!
Computerman45
11-07-2003, 04:20 PM
That is really wierd. What browser do you have? It works fine on mine... so hmm..... really wierd. Do you have Netsape or Internet Explorer? If you forgot the < or > tags anywhere the script won't work.... here is the entire script so you can copy and paste exactly where you want it to be.
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Nicholas Loar -->
<!-- Web Site: http://www.cass.net/~anarchy -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid";
songNum[2] = "http://rock.mididb.com/20030518/Bad_Company/Feel_Like_Makin_Love.mid";
songNum[3] = "http://rock.mididb.com/20030518/Cars/Lets_Go.mid";
songNum[4] = "http://rock.mididb.com/20030518/Dire_Straits/Walk_Of_Life.mid";
songNum[5] = "http://209.197.86.65/20030518/f/eagles/Already_Gone.mid";
songNum[6] = "http://rock.mididb.com/20030518/Guns_N_Roses/Knockin_On_Heavens_Door.mid";
songNum[7] = "http://rock.mididb.com/20030518/Guns_N_Roses/Sweet_Child_O_Mine.mid";
songNum[8] = "http://rock.mididb.com/20030518/Henley_Don/Boys_of_Summer.mid";
songNum[9] = "http://rock.mididb.com/20030518/Joplin_Janis/Piece_of_my_Heart.mid";
songNum[10] = "http://209.197.86.65/20030518/f/bryanadams/Cuts_Like_A_Knife.mid";
songNum[11] = "http://209.197.86.65/20030518/f/ledzep/DazedAndConfused.mid";
songNum[12] = "http://rock.mididb.com/20030518/ZZ_Top/Gimme_All_Your_Lovin.mid";
songNum[13] = "http://rock.mididb.com/20030518/Walsh_Joe/Rocky_Mountain_Way.mid";
songNum[14] = "http://rock.mididb.com/20030518/Van_Halen/Dance_the_Night_Away.mid";
songNum[15] = "http://209.197.86.65/20030518/f/u2/One.mid";
songNum[16] = "http://rock.mididb.com/20030518/Stewart_Rod/Do_Ya_Think_Im_Sexy.mid";
songNum[17] = "http://rock.mididb.com/20030518/Stewart_Rod/Maggie_May.mid";
songNum[18] = "http://rock.mididb.com/20030518/Stewart_Rod/Tonights_the_Night.mid";
songNum[19] = "http://rock.mididb.com/20030518/Rolling_Stones/Time_Is_on_my_Side.mid";
songNum[20] = "http://rock.mididb.com/20030518/Richard_Cliff/We_Dont_Talk_Anymore.mid";
songNum[21] = "http://rock.mididb.com/20030518/REO_Speedwagon/Take_It_on_the_Run.mid";
var music = null;
var track = 0;
var ver = navigator.appName;
function audioCheck(plugName) {
for (var i = 0; i < navigator.plugins.length; i++) {
if (navigator.plugins[i].name.toLowerCase() == plugName.toLowerCase()) {
for (var j = 0; j < navigator.plugins[i].length; j++) {
if (navigator.plugins[i][j].enabledPlugin) {
return true;
}
}
return false;
}
}
return false;
}
function chooseSong(s) { // ie
track = s.options[s.selectedIndex].value;
if (ver == "Microsoft Internet Explorer") {
document.all.music.src = songNum[track];
} else {
songPlay('play');
}
}
function songPlay(cmd) { // netscape
if (audioCheck("LiveAudio")) {
if (cmd == 'play') {
document.musicSource.play(false, songNum[track]);
}
} else {
alert("You Do Not Have The Correct Plugin");
}
}
// End -->
</script></head>
<BODY>
<center>
<form name=choose>
<select size=1 name=track onChange="chooseSong(this);">
<option value="0">Click For Music</option>
<option value="1">Running On Empty</option>
<option value="2">Feel Like Makin Love</option>
<option value="3">Let's Go</option>
<option value="4">Walk Of Life</option>
<option value="5">Already Gone</option>
<option value="6">Knockin On Heavens Door</option>
<option value="7">Sweet Child O Mine</option>
<option value="8">Boys of Summer</option>
<option value="9">Piece of my Heart</option>
<option value="10">Cuts Like A Knife</option>
<option value="11">Dazed And Confused</option>
<option value="12">Gimme All Your Lovin</option>
<option value="13">Rocky Mountain Way</option>
<option value="14">Dance The Night Away</option>
<option value="15">One</option>
<option value="16">Do Ya Think Im Sexy</option>
<option value="17">Maggie May</option>
<option value="18">Tonights the Night</option>
<option value="19">Time Is on my Side</option>
<option value="20">We Dont Talk Anymore</option>
<option value="21">Take It on the Run</option>
</select>
<input type=button onMouseDown="chooseSong(document.choose.track)" value=" Play ">
</form>
<script language="JavaScript">
<!-- Begin
var ver = navigator.appName;
if (ver == "Microsoft Internet Explorer") {
document.write('<bgsound src="#" ID=music loop=1 AUTOSTART=true>');
} else {
document.write('<embed type="audio/midi" src="http://rock.mididb.com/20030518/Browne_Jackson/Running_On_Empty.mid" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>
Also, don't put more than one <head> tag. If this does not work, I do have another player that you may like better. ;)
bigal
11-07-2003, 05:10 PM
The script i used is attached, i found it better than this one!
YOu may hafe to deleate all the tables, direct from my site DIR. See it in action: www.hellzbellz.netwww.hellzbellz.net (http://www.hellzbellz.net)
have a look at player_head - its the main one u need to edit.
the bit you will need to change (as well as the names) is:
function go() {
if (x != 0) {
location.href='sound/midi/'+x+'.htm'
the URL from the file ('sound/midi/) and the .htm (.mid?)
it puts 1,2,3,4,5,6,7, .... in place of the '+x+' , so ur files will have to be 1.mid 2.mid 3.mid etc..
i used an embedded media player and 1.htm , 2.htm etc
Have fun!
;)
AleyLee
11-07-2003, 08:18 PM
Well... I copied your code and pasted it on my index page... still won't work. I just don't get it! What really gets me is that it DOES work in FrontPage and even when I'm not online! I am using IE 6.0. Just for the heck of it, here is my webpage address, check it out if you want. http://webbed.012webpages.com/index.htm I really appreciate all your help, and yes, I would like to take you up on that offer with the other player! :)
bigal, thank YOU too! I'm going to go now and check out your page! :)
bigal
11-08-2003, 03:24 AM
one thing you will have to do is download all the midis and put them in a folder. then put the path from the script to the folder in the :
location.href='sound/midi/'+x+'.htm'
and name all the midis 1.mid, 2,mid etc
the 1.mid will be played when the fifst item on the list is selected! :)
Computerman45
11-08-2003, 04:51 PM
Ok, since that still does not work ... it doesn't with me either, lets try this this. (See attached ZIP file). If this STILL doesn't work, it isn't the script. it means that the web sites do not allow linking to the files. I noticed that geocities does not allow remote pictures to be displayed. In other words, the link to the file is fine, but the server does not allow ANY other website the ability to use the image. ..... Confusing huh?
AleyLee
11-09-2003, 11:32 PM
I think you are right because it still doesn't work. Guess I'll have to find another website with midi's and start over again... oh well. I did try to download those songs but after I downloaded one song I noticed it didn't save as a midi file, but a wav file instead, which was waaaaay to large a file for just one song, ya know? :rolleyes:
Thanks again, for trying to help me out! I'll let you know when I finally get one of those players going! :p ;) :)
bigal
11-10-2003, 10:15 AM
OK, if you want to download all the midis used, clear out ur temp files then go on one, so it plays in ur browser, then it is in your temp files, simply copy + paste out of there and you are done. E-Mail me if you need any further help! ;)
admin@hellzbellz.net :)
Computerman45
11-12-2003, 12:16 PM
... but isn't that copyrighting and 'stealing'? :P
bigal
11-12-2003, 12:26 PM
Having the script use the music from the origional location is classed as "leeching" there bandwidth. Copying the Midis to your own host is then using your own bandwidth. I doubt they will kick up a fuss about Midi's. But it would be better if u e-maild and asked if it is one they wrote! :)
AleyLee
11-17-2003, 12:18 PM
Hey bigal, guess what? I did what you suggested and it worked!! :) I cleared all my temp files, went to the site where all the midi's were, had to play each one so that they'd copy to my temp folder, but I got them all. I then opened each one in Windows Media Player (my default player) and saved them to my hard drive. Thanks bigal! :) See it in action, http://webbed.012webpages.com/index.htm ;)
can someone post a version of this script where you can use mp3's instead of midi's?
w5mav
04-13-2005, 12:23 PM
Another Question? When i load the page in FIREFOX it tells me "I do not have the correct plugin" Any way to make this script work in FIREFOX?