Click to See Complete Forum and Search --> : Music selection on web page


yuritard
02-16-2008, 01:20 PM
Hi

I have been trying to get soem script to work on my site for people to choose the music they listen to but it does not seem to be working this is how the script looks

<script language="JavaScript">

<!-- Begin
songNum = new Array();
songNum[0] = "#";
songNum[1] = "http://www.iamsofakingweetodddid.net/pagesongs/Addiction.midi";
songNum[2] = "http://www.iamsofakingweetodddid.net/pagesongs/Apologize.mp3";
songNum[3] = "http://www.iamsofakingweetodddid.net/pagesongs/WestlifeFlyingWithoutWings.mp3";

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>

<form name=choose>
<select size=1 name=track onChange="chooseSong(this);">
<option value="0">Click For Music</option>
<option value="1">Addiction</option>
<option value="2">Apologize</option>
<option value="3">Westlife Flying with out Wings</option>
<op</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="Apologize.mp3" AUTOSTART=false hidden=true VOLUME="90" name="musicSource" MASTERSOUND></EMBED>');
}
// End -->
</script>

if anyone is able to help i would be greatful

Waterfiets
02-23-2008, 05:46 AM
why don't you use a swf music player? I think it looks better then this js function.
You can choose from a few options on FlashFocus (http://www.flashfocus.nl/forum/showthread.php?t=7357) (it's a dutch flashwebsite, but i think you'll find it useful)
The one i used is ext sound01 (http://members.lycos.nl/tut1/uploadbestanden/sound%20voorbeelden/ext%20sound01.zip) (rightmouse-save as)

yuritard
02-23-2008, 06:01 AM
thank you for the tip i will have a look in to it i found out what the error was i was trying to spell Java with two J's not on this code but one above it so was throwing the whole page out now i just need a Dutch translater

thanks again for your help

Waterfiets
02-23-2008, 06:03 AM
Dutch translater at your service ;)