Newsgroup: it.comp.lang.javascript
Titolo: Playing Audio with Netscape and Javascript

I have a strange error when I run my html file with embeded mid files in
it. It works on some machines and does not work on others.
I am using Netscape 4.7 on all machines. It is not working on a machine
with 4.7, NT 4.0 and another machine with 4.7 , Win95. However it is
working on other machines with 4.7, NT or 95. It works fine on all
machines in IExplorer. Live Audio plug-in is installed on all machines.
Here is the live audio plug-in detail.
File name: D:\Program
Files\Netscape\Communicator\Program\plugins\npaudio.dll
Sound Player for Netscape Navigator, v.1.1.1515
audio/x-midi    MIDI   mid, midi    Yes
audio/midi      MIDI   mid, midi    Yes
The error I get is 'unable to reflect embed with index 1 - not loaded
yet?' where 1 is the index of the file I want to play. I have 6 numbers
from 0-5.
I am in desperate need to fix this as soon as possible.
I would really appreciate if someone could tell me what is the problem.
Thanks a lot.
Here is the code for the html file
-----------------------------------
<html>
<head>
<title>Music Juke Box</title>
<script type="text/javascript" language="JavaScript1.1">
function playing()
{
   var index=document.form1.list.selectedIndex;
   document.embeds[index].play();
   document.form1.out.value="Music playing";
   return false;
}
function stopping()
{
   var index = document.form1.list.selectedIndex;
   document.embeds[index].stop();
   document.form1.out.value="Music stopped";
   return false;
}
function pausing()
{
   var index = document.form1.list.selectedIndex;
   document.embeds[index].pause();
   document.form1.out.value="Music paused";
   return false;
}
function volup()
{
   var index = document.form1.list.selectedIndex;
   vol = document.embeds[index].GetVolume();
   newvol = vol + 50;
   if (newvol>=100)
   {
   	newvol = 600;
	document.embeds[index].setvol(newvol);
   	return false;
   }
}
function voldown()
{
   var index = document.form1.list.selectedIndex;
   vol = document.embeds[index].GetVolume();
   newvol = vol - 5;
   if (newvol<=0)
   {
   	newvol = 0;
	document.embeds[index].setvol(newvol);
    return false;
   }
}
</script>
</head>
<h4 align="center"><font color="red"><b>An Audio Juke
Box</b></font></h4>
<body background="or30.jpg">
<EMBED SRC="aha.mid" AUTOSTART="false" HIDDEN="true">
<EMBED SRC="all_that.mid" AUTOSTART="false" HIDDEN="true">
<EMBED SRC="danqueen.mid" AUTOSTART="false" HIDDEN="true">
<EMBED SRC="jaws.mid" AUTOSTART="false" HIDDEN="true">
<EMBED SRC="mjthriller.mid" AUTOSTART="false" HIDDEN="true">
<EMBED SRC="tarzanboy.mid" AUTOSTART="false" HIDDEN="true">
<form NAME="form1">
<div align="center"><table BORDER=0 CELLSPACING=0 CELLPADDING=10
WIDTH="60%">
<tr>
<td ALIGN="CENTER" BGCOLOR="orange">
<select NAME="list">
<option value="AHA-Take on Me">AHA-Take on Me
<option value="Ace of Base">Ace of Base
<option value="Dancing Queen">Dancing Queen
<option value="Jaws">Jaws
<option value="Thriller">Thriller
<option value="Tarzan Boy">Tarzan Boy
</select></td>
</tr>
<tr>
<td ALIGN="CENTER" BGCOLOR="gray"><input TYPE="submit" VALUE="PLAY"
onClick="return playing(this)"><input TYPE="submit" VALUE="STOP"
onClick="return stopping(this)"><input TYPE="submit" VALUE="PAUSE"
onClick="return pausing(this)"><input TYPE="submit" VALUE="Volume UP"
onClick="return volup(this)"><input TYPE="submit" VALUE="Volume DOWN"
onClick="return voldown(this)"></td>
</tr>
<tr>
<td ALIGN="CENTER" BGCOLOR="violet"><input TYPE="text" NAME="out"
value=""></td>
</tr>
</table></div>
</form>
</body>
</html>
Sent via Deja.com 
http://www.deja.com/
Before you buy.

 ...
