Problem JavaScript

willemvo

New Member
Messages
19
Reaction score
0
Points
0
Can anybody tell me what i did wrong:dunno:?? because it doesn't play any sounds at all!! I realy don't understand:rant2:
Code:
<html>
<head>
<script type="text/javascript">
<!-- 
counter = 0;
songs = new Array();

function addsong() {
 file = document.forms[0].file.value;
 if(file == "") {
 alert("Choose a sound.\rPress the button bladeren...");
}
 else {
  fn = file;
  while(fn.indexOf() != -1) {
   pos = fn.indexOf();
   fn = fn.substring(fn.lenght);
  }
 songs[counter] = file;
 document.forms[0].Liste[counter] = new Option(fn, file, false, true);
 counter++;
 document.forms[0].file.value = "";
 }
}

function music() {
 document.all.sound.src=document.Form.Liste.options[document.Form.Liste.selectedIndex].text;
}

function stop() {
 document.all.sound.src="";
}

function count() {
 document.Form.songs.value=document.Form.Liste.options.length;
}

function deletethis() {
 if(counter > 0) {
  counter--;
  document.forms[0].Liste[counter] = null;
  songs[counter] = "";
 }
 else {
 alert("There are no files found \rto delete from the Playlist!");
 }
}

function nach_unten() {
 var al = document.Form.Liste.options.length; al -= 1;
 if(document.Form.Liste.selectedIndex < al){
  document.Form.Liste.options[document.Form.Liste.selectedIndex++];
  adresse();
 }
}

function nach_oben() {
 if(document.Form.Liste.options[0].selected != true){
  document.Form.Liste.options[document.Form.Liste.selectedIndex--];
  adresse();
 }
}

function adresse() {
 fn = document.Form.Liste.options[document.Form.Liste.selectedIndex].text;
 char = unescape("%5C");
 while(fn.indexOf(char) != -1) {
  pos = fn.indexOf(char);
  fn = fn.substring(pos + 1, fn.length);
  document.Form.name2.value=fn;
  }
}
// -->
</script>

</head>
<body onLoad="count()" onClick="count()"><bgsound name="sound" id="sound" src="">
<form name="Form">
<table align=center cellpadding="5" cellspacing="0" bgcolor="#EFEFEF">
 <tr>
  <td><b>
    <input type=file name=file size=21>     
    <input type=button value="Toevoegen" onClick="addsong(); adresse()">    
    <input type="button" value="Verwijderen" onClick="deletethis(); document.Form.name2.value=''">
    <br><br>
    <input type="text" name="name2" value="" size="47" style="color: #FF0000" readonly>    
    
    <input type="button" value=" \/ " onClick="nach_unten()">
    <input type="button" value=" /\ " onClick="nach_oben()">   
    <input type="button" name="empezar" value=" Play" onClick="if(document.Form.songs.value> 0){adresse(); music()}">  
    <input type="button" name="detener" value="Stop" onClick="stop()">
    <br>
    <select name=Liste size=10 style="width: 500px; font-size: 9px; color: #0000CC" onClick="if(document.Form.songs.value > 0){adresse(); music()}"></select><br>
    </b>Je hebt: <input type="text" name="songs" size="1" readonly>bestand(en) in
    de Playlist.
  </td>
 </tr>
</table>
</form>

</body>
</html>
THANKS
 
Top