Pause/Resume Button in Javascript Countdown Timer

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
northshore421c
Posts: 2

Pause/Resume Button in Javascript Countdown Timer

I'm using the countdown timer:
https://coursesweb.net/javascript/countd ... ed-form_s2

I'm having a very hard time adding a "Pause/Resume" button to the javascript. I'm very new to java and would greatly appreciate any help that could be offered. I'M PULLING MY HAIR OUT, WHAT'S LEFT OF IT!

If the link above is not showing up. Please do a search for " Countdown Timer with starting time added into a form ".

Happy Holidays,
Ray

Admin Posts: 805
Hello
To this page:
https://coursesweb.net/javascript/countd ... added-form
there is a new version of the Countdown Timer script, with Start /Pause /Resume functions in the same button, and another two buttons for Restart and End.

Happy Holidays,
Marius

northshore421c Posts: 2
Thank you very much for the assistance. Now I have another quagmire! I'm running a frequency oscillator on my site through javascript. Alas, I have one more issue that I need help with in order to complete my project. I'm using the countdown timer with pause and resume that you suggested, which is working perfectly on my site. I've looked at all the javascript mute/unmute scripts and they all seem to be wanting and "source SRC" in order to mute that file. Again I'm using the frequency oscillator.

Here is the script for the "Pause/Resume" that you gave me.

Code: Select all

function startPauseCT(){
    if(parseInt(el_mns.value) >0 || parseInt(el_scs.value)>0 || endct ==1){
      ctpause *=-1;
      if(ctpause ==1){ //Start and set next click as Pause
        el_btnct.value ='Pause';
		
	window[obnm].countdownTimer();
	  }
      else el_btnct.value ='Resume';
    }
  }
All I need it to be able to mute the tone generator when I press the timer Pause Button, then resume the tone when I press resume to co-inside with the timer. I've tried

Code: Select all

 function stop() {
    oscillator.noteOff(0);
    fire('stop');
  }
Really I just want to mute and unmute the sound. Again Thanks so much in advance for the help!
Ray

Admin Posts: 805
I not know how the osillator /sound is muted and unmuted, but if you know and you want to combine that code with the script for the "Pause/Resume", add Unmute /start when ctpause is 1, and Mute /stop to "else" statement.

Code: Select all

function startPauseCT(){
  if(parseInt(el_mns.value) >0 || parseInt(el_scs.value)>0 || endct ==1){
    ctpause *=-1;
    if(ctpause ==1){ //Start and set next click as Pause
      el_btnct.value ='Pause';
      //HERE ADD CODE FOR UNMUTE /START
      window[obnm].countdownTimer();
    }
    else {
      el_btnct.value ='Resume';
      //HERE ADD CODE FOR MUTE /STOP
    }
  }
}

Similar Topics