javascript - Play audio when clicking on button and redirect after sound is done playing -


i made simple site 4 buttons. if click 1 want play sound , when sound done playing (or after 'x' amount of seconds) want redirect.

this code far. have no idea on how put in sound , delay.

<html> <head>  <link rel="stylesheet" type="text/css" href="/level1/style.css">    </head>  <body>    <img style= "top: 20px; left: 200px; height:900px; width: 800px position:      absolute;" src="\images\border.jpg"> <img style= "position: absolute; top: 50px; left: 50px; height:120px; width:  120px;" src="\images\level1.jpg">  <a href="#"><img src="\images\1a1.jpg" onmouseover="this.src='/images/1a1g.jpg'" onmouseout="this.src='/images/1a1.jpg'"  id="a1"> </a> <a href="\level1\index.html"><img src="\images\1a2.jpg" onmouseover="this.src='/images/1a2g.jpg'" onmouseout="this.src='/images/1a2.jpg'" " id="a2"> </a> <a href="\level1\index.html"><img src="\images\1a3.jpg"   onmouseover="this.src='/images/1a3g.jpg'" onmouseout="this.src='/images/1a3.jpg'"  id="a3"> </a> <a href="\level1\index.html"><img src="\images\1a4.jpg" onmouseover="this.src='/images/1a4g.jpg'" onmouseout="this.src='/images/1a4.jpg'"  id="a4"> </a>       </body>  </html> 

you need embed html audio element:http://www.w3schools.com/tags/ref_av_dom.asp

with method play() in eventlistener, described on page can start audio, when audio playing has ended: http://www.w3schools.com/tags/av_event_ended.asp can set timeout with

`var seconds= 3; settimeout(         function(){               /*  code executed, after defined delay  */               }  seconds * 1000);` 

Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -