-
Salve. Spero sia la sezione adatta...:?
Sto realizzando un sito web dedicato ad un circolo tennis, e vorrei inserire il suono di un "colpo", preso da un videogioco, al passaggio del mouse sui link.Google mi ha recuperato questo codice:
[FONT=Courier, monospace][COLOR=#006600]<script LANGUAGE="JavaScript"> <!-- var aySound = new Array(); aySound[[FONT=Courier, monospace][COLOR=#ff6600]0[/COLOR][/FONT]] = "[FONT=Courier, monospace][COLOR=#ff6600]my_sound.wav[/COLOR][/FONT]"; document.write('<BGSOUND id="auIEContainer">') IE = (navigator.appVersion.indexOf("MSIE")!=-1 && document.all)? 1:0; NS = (navigator.appName=="Netscape" && navigator.plugins["LiveAudio"])? 1:0; ver4 = IE||NS? 1:0; onload=auPreload; function auPreload() { if (!ver4) return; if (NS) auEmb = new Layer(0,window); else { Str = "<DIV ID='auEmb' STYLE='position:absolute;'></DIV>"; document.body.insertAdjacentHTML("BeforeEnd",Str); } var Str = ''; for (i=0;i<aySound.length;i++) Str += "<EMBED SRC='"+aySound[i]+"' AUTOSTART='FALSE' HIDDEN='TRUE'>" if (IE) auEmb.innerHTML = Str; else { auEmb.document.open(); auEmb.document.write(Str); auEmb.document.close(); } auCon = IE? document.all.auIEContainer:auEmb; auCon.control = auCtrl; } function auCtrl(whSound,play) { if (IE) this.src = play? aySound[whSound]:''; else eval("this.document.embeds[whSound]." + (play? "play()":"stop()")) } function playSound(whSound) { if (window.auCon) auCon.control(whSound,true); } function stopSound(whSound) { if (window.auCon) auCon.control(whSound,false); } //--> </script>[/COLOR][/FONT]Fonte: *http://webmaster.lycos.it/tips/988901033/
Purtroppo gira solo su Internet Explorer, mentre vorrei quell'effetto anche sotto Firefox, per lo meno.
Si può fare niente per "migliorare" il codice che ho trovato e renderlo universale?
Oppure inserire un altro codice appositamente per Firefox?Grazie.

-
Ciao gas75, sposto la discussione in Altri linguaggi per il web, affinché possa avere la meritata visibilità

Ciao
-
-
Prova a dare un'occhiata a questo:
http://www.javascripter.net/faq/sound/play.htmviene usato un bottono per attivare l'audio, però non è un problema perchè basta richiamare la funzione nellevento onmouseover.
Comunque a parer mio l'audio quando si passa sui menu è parecchio irritante, non sono pochi i siti che ho abbandonato per questa cosa.

-
Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.
Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.
Con il tuo contributo, questo post potrebbe essere ancora migliore 💗
Registrati Accedi
" 