JavaScript select image and and play an audio by clicking the button using html and javascript

<audio id="audio1" src="a.wav"></audio>
<audio id="audio2" src="b.wav"></audio>

<img id="img1" src="a.png" alt=""  onselect="select()"  />
 <img id="img2" src="a.png" alt=""  onselect="select()"  />  

<input type="button"  onclick="play()">

i have multiple images in my code a and every image has its respective audio what i want to do is i want to select the image and on clicking the button i want to play the audio against that particular image .all this i want to do using javascript and html . so can any one help me javascript part?

Answer:1

Just add this and it should work:

<img id="img1" src="a.png" alt=""  onclick="select(this.id)"  />
 <img id="img2" src="a.png" alt=""  onclick="select(this.id)"  />  

<script>
  function select(num){
       var x = num.match('/\d+/');
       var audio = document.getElementById("audio"+x);
       audio.play();
                 }
</script>
Answer:2

I have an application that serves SSRS reports. A given report is accessed in the following way: https://reportserver.com/reportname Upon clicking View Report, a postback is submitted to the report ...

I have an application that serves SSRS reports. A given report is accessed in the following way: https://reportserver.com/reportname Upon clicking View Report, a postback is submitted to the report ...

  1. birt report parameters query string
  2. ssrs report parameters query string

I want to retrieve one row from database and show this information on my page. The problem is that subscribe is async so it's not executed immediately therefore I can't access the data from the ...

I want to retrieve one row from database and show this information on my page. The problem is that subscribe is async so it's not executed immediately therefore I can't access the data from the ...

  1. canvas
  2. canada
  3. cancelled
  4. canceled vs cancelled
  5. cancun
  6. canada goose
  7. cane corso
  8. canes
  9. canadian prime minister
  10. cancun flights
  11. canker sore
  12. candy
  13. cancer
  14. canon
  15. canvas prints
  16. cancer sign
  17. candace owens
  18. canada news
  19. candytopia
  20. canlis

How can I check or receive a message when the a Unity WebGL app is finished with loading and ready for use? What I want is to run a JavaScript function of my Webinterface after the WebGL App is ready.

How can I check or receive a message when the a Unity WebGL app is finished with loading and ready for use? What I want is to run a JavaScript function of my Webinterface after the WebGL App is ready.

  1. unity webgl javascript callback
  2. unity webgl javascript communication
  3. unity webgl javascript error
  4. unity webgl javascript
  5. unity webgl javascript api
  6. unity webgl js
  7. unity webgl call javascript function
  8. unity webgl call javascript from c#
  9. unity webgl execute javascript
  10. unity webgl node.js
  11. unity webgl asm.js
  12. unity webgl three.js
  13. unity webgl unityloader.js
  14. unity webgl call external javascript
  15. unity webgl javascript 連携

I am really new to vueJS. I try to get two input value, adding them together, and show the result. I found it is really wired, because when number1 minus number3, or number1 multiplied number2, or ...

I am really new to vueJS. I try to get two input value, adding them together, and show the result. I found it is really wired, because when number1 minus number3, or number1 multiplied number2, or ...

  1. calculating numbers with powers
  2. calculating numbers with exponents
  3. calculating numbers with excel
  4. calculating with numbers crossword clue
  5. calculating with numbers
  6. calculating with numbers crossword
  7. calculating numbers on a rental property
  8. calculating numbers from percentages
  9. calculating numbers of combinations
  10. calculating numbers in scientific notation
  11. calculating numbers of subatomic particles
  12. calculating numbers in standard form
  13. calculating numbers from ratios
  14. calculating numbers in brackets
  15. calculating numbers of atoms
  16. calculating numbers in numerology
  17. calculating numbers in your head
  18. calculating numbers of subatomic particles questions
  19. calculating numbers in between
  20. calculating numbers in access