<head>   
<script type="text/javascript"> 
function playPause(x)           
{ 
    var myAudio=document.getElementById(x); 
  if (myAudio.paused) 
    myAudio.play(); 
  else 
    myAudio.pause(); 
} 
</script>
<head>
<body>

<audio id="Soundx1" src="../audio/2.mp3"></audio>  
<button style="background-image:url(../images/audio1.jpg); width:45px; height:45px;    
border:transparent; margin:0px 0px 0px 0px;background-repeat:     
no-repeat;background-color:white;" onclick="playPause('Soundx1');" ></button>

<audio id="Soundx2" src="../audio/2.mp3"></audio>  
<button style="background-image:url(../images/audio2.jpg);background-color:white;     
width:45px; height:45px; border:transparent; margin:0px 0px 0px 0px;background-repeat:    
no-repeat;" onclick="playPause('Soundx2');" ></button>
<body>

<Article moved from Java to JavaScript by JamesCherrill>

  1. I don't see any question in your post
  2. this is the Java forum. Java (unlike it's name might suggest) is not related to JavaScript. this post might be more for this forum
  3. there is no big mistery in performing several actions on a single button click. what exactly is your point?
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.