salut à tous,
je désire inserer du son dans ma page qui serai joué lors de plusieurs evenement différents, sachant que mes sons sont des mp3 comment je pourrai faire ceci??
merci pr votre aide![]()
salut à tous,
je désire inserer du son dans ma page qui serai joué lors de plusieurs evenement différents, sachant que mes sons sont des mp3 comment je pourrai faire ceci??
merci pr votre aide![]()
Euh, un embed ? un object ? un bgSound ?
En tout cas il n'y a pas de fonction préprogrammée "playSound" en JS...
dommage qu'il n'existe un truc préprogrammé pr sa, sinon s'il ya une methode simple pour ça je veux bien la connaitre...
En survolant le web, j'ai trouvé ceci :Je n'ai hélas pas pu tester...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 <script LANGUAGE="JavaScript"> <!-- var aySound = new Array(); aySound[0] = "mon_son.wav"; 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>
Marche chez moi : http://javascript.internet.com/page-...ick-sound.html
super! merci bcp Fremy!!![]()
Partager