If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Junior Member
    Join Date
    Nov 2011
    Member #
    Hi Everybody!

    I'm trying to create a checkbox that, when checked, loops a soundfile and when unchecked, stops the sound file. So basically "checked=play", "unchecked=stop". I have some simple javascript code that works by using two separate buttons, one for play and one for stop. But I would like this to be controlled by a single checkbox. Simple code below. Any ideas? Thanks in advance!

    <!DOCTYPE html>


    <script type="text/javascript">

    /*-----this code asks whether the button contains var "start" or "stop" and plays, stops accordingly----*/

    function EvalSound(soundobj,check){
    var thissound=document.getElementById(soundobj);
    else if(check=="stop")

    <embed src="SOUND.MP3" loop='true' autostart='false' width='0' height=0' id="sound" enablejavascript="true" />
    <button class="start" onclick="EvalSound('sound','start');">start</button>
    <button class="stop" onclick="EvalSound('sound', 'stop');">stop</button>



Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search tags for this page

javascripit sond off


javascript sound off


sound on off javascript

Click on a term to search for related topics.
All times are GMT -6. The time now is 12:18 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: