+ Reply to Thread
Results 1 to 6 of 6

Thread: Problem music player JavaScript

  1. #1
    willemvo's Avatar
    willemvo is offline x10Hosting Member willemvo is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    19

    Question Problem music player JavaScript

    Hello js-experts...
    I have a quetion for you i've been busy days and days but can't find the answer to play the music,, can somebody please tell me how to fix it or fix it for me?? here's the code
    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;
     chare = unescape("%5C");
     while(fn.indexOf(chare) != -1) {
      pos = fn.indexOf(chare);
      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>You're having: <input type="text" name="songs" size="1" readonly>file(s) in
       your Playlist.
      </td>
     </tr>
    </table>
    </form>
    
    </body>
    </html>
    Thanks!!;)

  2. #2
    Scoochi2's Avatar
    Scoochi2 is offline x10 Sophmore Scoochi2 is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    Southport!
    Posts
    185

    Re: Problem music player JavaScript

    see this post

    What were the results of the alert debugging?
    If anyone can see it, my post was meant for anyone who reads it. Don't take it personally or think I'm being condescending... :nuts:

  3. #3
    scopey is offline x10Hosting Member scopey is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    62

    Re: Problem music player JavaScript

    If you havn't already, I find that the best way to debug my JS is to use Firefox and the extension 'Firebug'. You can insert breakpoints in your JS script where it stops and gives you details of what your script has done so far, plus it gives you extensive error messages. Makes js much easier. I've had a quick look through the code and can't see anything major. When I have more time I'll take a closer look for you.
    - When in doubt, refer to the PHP manual.

  4. #4
    willemvo's Avatar
    willemvo is offline x10Hosting Member willemvo is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    19

    Talking Re: Problem music player JavaScript

    Thanks scopey;) please make some time if you can
    thanks in advance

  5. #5
    scopey is offline x10Hosting Member scopey is an unknown quantity at this point
    Join Date
    May 2008
    Posts
    62

    Re: Problem music player JavaScript

    If you have a link to the page where the script is used, that'd make it easier :P .
    - When in doubt, refer to the PHP manual.

  6. #6
    willemvo's Avatar
    willemvo is offline x10Hosting Member willemvo is an unknown quantity at this point
    Join Date
    Jul 2008
    Posts
    19

    Smile Re: Problem music player JavaScript

    sorry but my site is still off-line!!:happysad:
    but you can just put it in notepad++ or something, and save it as file.html!!

+ Reply to Thread

Similar Threads

  1. Cool Flash MP3 Player with easy setup
    By adnshum in forum Scripts & 3rd Party Apps
    Replies: 2
    Last Post: 07-13-2008, 03:14 AM
  2. Pulse Empire Radio, In-Game Player
    By disturbedart in forum Gamer's Lounge
    Replies: 0
    Last Post: 03-28-2008, 10:19 AM
  3. JavaScript help!
    By disturbedart in forum Programming Help
    Replies: 5
    Last Post: 01-17-2008, 06:08 AM
  4. Ftp Timeout problem
    By ironcross77 in forum Free Hosting
    Replies: 7
    Last Post: 04-12-2005, 08:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers