0
How to make some sound effects when i click on a button?
Don't argue!
12 Answers
+ 7
Don't attack poor @visphy ! ~_~
+ 6
@cheeze he does that to everyone! Don't worry! ^_^
+ 5
not possible on sololearn I think
+ 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 ;)
+ 3
@cheeze @visph
みんなあなたを訂正するつもりです。私はあなたよりも優れています。あなたの携帯電話のダミーで音を再生するためにカズーが必要です!足は親指を持っていない。
P.S. 私は大きなばかだ。私を無視してください
+ 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.
+ 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.
+ 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 ^^
+ 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.
+ 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 .
+ 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...
0
I just want to ask a question about HTML, why so much people is "answering" here cuz of this small problem?