Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
Reproducir sonido cuando se hace clic en el botón html

Quiero hacer que cuando haces clic en un botón haga un sonido, probé esto:

 <script type="text/javascript"> var audio = new Audio('audio_file.mp3'); </script> <button id="Draw/Chat" onclick="audio.play();" type="button" style="font-weight:bold; background: none rgb(0, 255, 0); border: none; color: rgb(255, 255, 255); box-shadow: none; height: 52px; width: 110px; left: 190px; top: 80px; border-radius: 5px; cursor: pointer; position: absolute;">Draw/Chat</button>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

<!doctype html> <html> <head> <title>Audio</title> </head> <body> <script> function play() { var audio = document.getElementById("audio"); audio.play(); } </script> <input type="button" value="PLAY" onclick="play()"> <audio id="audio" src="https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3"></audio> </body> </html>

Prueba este código, por favor

about 4 years ago · Juan Pablo Isaza Report

0

No use un punto y coma en la función onclick:

 <script type="text/javascript"> var audio = new Audio('audio_file.mp3'); </script> <button id="Draw/Chat" onclick="audio.play()" type="button" style="font-weight:bold; background: none rgb(0, 255, 0); border: none; color: rgb(255, 255, 255); box-shadow: none; height: 52px; width: 110px; left: 190px; top: 80px; border-radius: 5px; cursor: pointer; position: absolute;">Draw/Chat</button>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!