Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2008
    Messaggi
    6

    help javascript sound!!

    salve a tutti...sto cercando di riprodurre un file mp3 in una pagina javacript, ma invece di partire appare al posto del player un rettangolo arancione e non fa un tubo...qualcuno mi puo aiutare??
    non fate caso al resto del codice...ci sto ancora lavorando..

    codice:

    <html>
    <head>
    <script>
    var tabella="";
    var player="";
    var resto=new Array();
    var resto1=new Array();
    var risultato="";
    resto[0]="gino";
    resto[1]="rinrin";
    resto[2]="mino";
    resto[3]="pino";

    function PlayerOpen() {
    player="";

    player +=" <embed src=./b.mp3 autostart=true loop=false width=300 height=42 controller=true bgcolor=#FF9900></embed>";

    }

    function converti(arr){
    risultato="";
    for(i=0;i<arr.length;i++){
    risultato+=""+arr[i]+"\n";
    }
    }

    function ricerca(){

    k=0;
    trovato=false;
    appo=new Array();
    resto1=new Array();
    ric=document.form.cerca.value;
    alert(ric);
    for(i=0;i<resto.length;i++){
    trovato=false;
    for(j=0;j<=(resto[i].length-ric.length)&&!trovato;j++){
    appo[k]=resto[i].substring(j,j+ric.length);
    if(appo[k]==ric){
    resto1[k]=""+resto[i];
    k++;
    trovato=true;
    }
    }
    }
    elabora(1);
    }

    function elabora(n_menu){
    converti(resto1);
    tabella="";
    tabella+="<table>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(1);>brani</td>";
    tabella+="<td rowspan=5 valign=top>";
    tabella+="<input type=text id=cerca nome=cerca></input>";
    tabella+="<input type=button value=Vai onClick=ricerca();></input>";
    tabella+="<textarea readonly rows=4 cols=21>"+risultato+"</textarea>";
    tabella+="</td></tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(2);>album</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(3);>artisti</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(4);>generi</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(5);>dierrettor</td>";
    tabella+="</tr>";
    tabella+="</table>";

    menu();
    }

    function getStart(){
    PlayerOpen();
    resto1=resto;
    tabella="";
    tabella+="<table>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(1);>brani</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(2)>album</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(3)>artisti</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(4)>generi</td>";
    tabella+="</tr>";
    tabella+="<tr>";
    tabella+="<td onMouseOver=elabora(5)>dierrettor</td>";
    tabella+="</tr>";
    tabella+="</table>";

    menu();
    }
    function menu(){
    bodi = document.getElementById('bodi');
    stringone="";
    stringone+="<table width=100%>";
    stringone+="<tr>";
    stringone+="<td colspan=2><div align=center>titolo</div></td>";
    stringone+="</tr>";
    stringone+="<tr>";
    stringone+="<td width=30%>";
    stringone+=tabella;
    stringone+="</td>";
    stringone+="<td width=70%>";
    stringone+=player;
    stringone+="</td>";
    stringone+="</tr>";
    stringone+="</table>";
    bodi.innerHTML=stringone;
    }
    </script>
    </head>
    <body onload="getStart()">

    <form name="form" action="GraficoApplet.php" method="post">
    <span id="bodi"></span>
    </form>

    </body>
    </html>

  2. #2
    vedo nel tuo codice che crei un embed (player="<embed bla bla...>"), ma non dove lo inserisci nel documento (innerhtml).

    Se hai difficoltà comunque puoi dare un'occhiata quì:
    http://javascript.html.it/articoli/l...scriptaculous/

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.