0

How to make some sound effects when i click on a button?

Don't argue!

10th Jan 2017, 10:51 AM
caleb deng
caleb deng - avatar
12 Answers
+ 7
Don't attack poor @visphy ! ~_~
14th Jan 2017, 9:31 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 6
@cheeze he does that to everyone! Don't worry! ^_^
14th Jan 2017, 9:15 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
not possible on sololearn I think
10th Jan 2017, 11:08 AM
Ahri Fox
Ahri Fox - avatar
+ 4
Don't have test @cheeze code outside Sololearn, but find better way more recommended: window.onload=function() { document.getElementById("yourBtn").onclick = function() { var sound=new Audio("http://s1download-universal-soundbank.com/wav/2500.wav"); sound.play(); } } ... which is working in code playground ;)
14th Jan 2017, 8:57 AM
visph
visph - avatar
+ 3
@cheeze @visph みんなあなたを訂正するつもりです。私はあなたよりも優れています。あなたの携帯電話のダミーで音を再生するためにカズーが必要です!足は親指を持っていない。 P.S. 私は大きなばかだ。私を無視してください
14th Jan 2017, 11:58 AM
Ahri Fox
Ahri Fox - avatar
+ 2
Tell me if this works, document.getElementById("yourBtn").onclick = function() { var elem = document.createElement("audio") ; document.body.appendChild("audio") ; document.getElementsByTagName("audio")[0].setAttribute("src", "myMP3.mp3").setAttribute("autoplay", "true") } // I believe there is a better way, this is not recommended.
14th Jan 2017, 2:07 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
@visph I have a feeling that you stalk on my account and correct on what I posted. Thank you for giving me a negative impression on what kind of person you are.
14th Jan 2017, 9:11 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
It's absolutly not my intention to "correct" you: don't you have receive some thumb up from me also? ;) It's just that if I saw something which I can complete, or specify, I do it... But tell me if you're hurt by that, so I will strive to not answer after you ^^
14th Jan 2017, 9:16 AM
visph
visph - avatar
+ 2
Yeah, I don't mind you giving a better solution but your first sentence is condescending in a way that it actually 'boo's the answers of others. "It's absolutely not my intention to "correct" you" yeah, what are the chances you meet this question unless you purposely stalk my account. "Have you not received some thumbs up from me also?" i never need thumbs up from people who are giving them needlessly.
14th Jan 2017, 9:18 AM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
@visph @cheeze don't worry too much on this small misunderstanding ....you can all answer when you want to ....@visph just post code or answer without hurting others :) you know nobody is perfect .
14th Jan 2017, 9:24 AM
Sun
Sun - avatar
+ 1
So excuse me of that: My common english is very bad, and maybe ( probably ) I don't ever write what I think to say... My first sentence here, was about that I have test your code in code playground, confirm it wasnt working on sololearn as @Ahri Fox have previously noticed ( for answer to your question ^^ ), and I said that I don't know if in normal browsers/condition this was working or not... Perhaps was it too much shortchut, or bad said, but It doesn't seems that's condescending? Well, please excuse me again...
14th Jan 2017, 9:30 AM
visph
visph - avatar
0
I just want to ask a question about HTML, why so much people is "answering" here cuz of this small problem?
15th Jan 2017, 1:57 AM
caleb deng
caleb deng - avatar