Monday, 26 October 2015

Is it actually possible to use onclick/sound effects with links (anchor tag)?

Question's in the title.... I'm sure its possible (I hope lol). Someone with more programming chops enlighten me. Currently playing around with the onclick function on a practice site I'm building and its works perfectly with everything I try. Buttons, Paragraphs, Headings, whatever... but when I change the element/tags into a link and add the href attribute no sound... silent. Even the <a></a> (anchor tags) work without and href. What gives? Obviously its an anchor tag specific quirk but I'm stump as to why. How can I get this to work? Code is below.

<div onclick="play()">Click</div> <audio id="audio" src="/Users/hahagotemm/Desktop/Acension-2/sounds/263133__pan14__tone-beep.wav" ></audio> 

<script> function play(){ audio.play(); } </script>



Epic visual tool

Epson 5030UB 2D/3D 1080p 3LCD Projector Submitted October 27, 2015 at 02:03AM by winnnnnnnnn http://ift.tt/1WeFGdZ

No comments:

Post a Comment