audio - JavaScript, playing sound effect in onmouseover event -
I think that's a common question, but whatever tutorial and post I've seen, I've helped me so far is. Whenever a cursor is on a menu image, I still want a sound to play that is also a link. There is already an instruction in the on-homeup event for the image, but I have read that there may be many instructions in this event. Here's the code (sorry it looks messy)
& lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" & gt; Var sonido = document.getElementById ("neonclip"); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Audio id = "neonclip" & gt; & Lt; Source src = "http://www.eleyte.net/portafolio/neon.mp3" type = "audio / mp3" /> & Lt; / Audio & gt; & Lt; Div style = "text-align: center; margin-top: 130px;" & Gt; & Lt; A href = "pagelink" & gt; & Lt; Img onmouseover = "this.src = 'img2'; sonido.play (document.getElementById ('neonclip')) onmouseout =" this. Src = 'img1' "src =" img1 "/> & lt; / a & gt ; I did this after an example, but it does not work I know that it will be a problem in Firefox because it does not support the MP3 format, but this is another story. Thanks in advance!
Only users play sound in all browsers in the two formats below.
Lt; audio preload id = "neon clip"> Source src = "sound / dingdong / 57718 ^ DingDong.mp3" type = "audio / mpeg" & gt; source src = "sound / dingdong / dingdong. Ogg "type =" audio / og "> and try this to try the sound
& Lt; a href = "pagelink" & gt; & lt; img onmouseover = "this.src = 'img2'; / html>
Comments
Post a Comment