Skip to content

Instantly share code, notes, and snippets.

Last active Aug 29, 2015
What would you like to do?
play audio using a button/javascript on an html webpage
<!DOCTYPE html>
<audio id="audio1" src="audio1.ogg" autobuffer></audio>
var aid = document.getElementById("audio1");
aid.volume = 0.2;
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);;
<div align="center">
<input type="button" value="Click Me! Click Me!" onClick="EvalSound('audio1')">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment