Title: Run after HTML code?
Last modified: September 23, 2016

---

# Run after HTML code?

 *  Resolved [convictedvapour](https://wordpress.org/support/users/chronicbubble/)
 * (@chronicbubble)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/)
 * I have made a countdown time for 48 hours, and as soon as it counts down, it 
   resets. I now need it to run a code on completion and allow it to reset as per
   the code below.
 * How can I go about doing that?
 * Thanks guys, your help is highly appreciated.
 * The Countdown Code:
 *     ```
       <script type = "text/javascript">
   
       var timeInSecs;
       var ticker;
   
       function startTimer(secs) {
       timeInSecs = parseInt(secs);
       ticker = setInterval("tick()", 1000); 
       }
   
       function tick( ) {
       var secs = timeInSecs;
       if (secs > 0) {
       timeInSecs--; 
       }
       else {
       clearInterval(ticker);
       startTimer(172800);  // start again
       }
   
       var hours= Math.floor(secs/3600);
       secs %= 3600;
       var mins = Math.floor(secs/60);
       secs %= 60;
       var pretty = ( (hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs;
       document.getElementById("countdown").innerHTML = pretty;
       }
   
       startTimer(172800);  // 48 hours in seconds
       ```
   
 * The code I need to run after the 48 hours has passed then reset as per above:
    -  This topic was modified 9 years, 8 months ago by [convictedvapour](https://wordpress.org/support/users/chronicbubble/).
    -  This topic was modified 9 years, 8 months ago by [convictedvapour](https://wordpress.org/support/users/chronicbubble/).
    -  This topic was modified 9 years, 8 months ago by [convictedvapour](https://wordpress.org/support/users/chronicbubble/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [convictedvapour](https://wordpress.org/support/users/chronicbubble/)
 * (@chronicbubble)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/#post-8212863)
 * I will rephrase better. I want to add an echo_do_shortcode in the code below 
   as where it is commented to be added. Thanks!
 *     ```
       <script type = "text/javascript">
   
       var timeInSecs;
       var ticker;
   
       function startTimer(secs) {
       timeInSecs = parseInt(secs);
       ticker = setInterval("tick()", 1000); 
       }
   
       function tick( ) {
       var secs = timeInSecs;
       if (secs > 0) {
       timeInSecs--; 
       }
       else {
       clearInterval(ticker);
       //I WANT TO ADD A ECHO_DO_SHORTCODE HERE
       startTimer(172800);  // start again
       }
   
       var hours= Math.floor(secs/3600);
       secs %= 3600;
       var mins = Math.floor(secs/60);
       secs %= 60;
       var pretty = ( (hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins + ":" + ( (secs < 10) ? "0" : "" ) + secs;
       document.getElementById("countdown").innerHTML = pretty;
       }
   
       startTimer(172800);  // 48 hours in seconds
       ```
   
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/#post-8213158)
 * Is the terminology “echo” bit not important? I’m saying this because echo is 
   a PHP command and the solution will be wholly different in PHP than in JavaScript.
 *  Thread Starter [convictedvapour](https://wordpress.org/support/users/chronicbubble/)
 * (@chronicbubble)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/#post-8216115)
 * OK good point. It’s simply I am trying to make a countdown with HH:MM:SS that
   countdowns every 24 hours then resets itself and starts again. Then I can look
   to intergrate my custom coding.
 *  Thread Starter [convictedvapour](https://wordpress.org/support/users/chronicbubble/)
 * (@chronicbubble)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/#post-8216130)
 * Will code up something else! Thanks for the advice.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Run after HTML code?’ is closed to new replies.

## Tags

 * [execute](https://wordpress.org/support/topic-tag/execute/)
 * [html](https://wordpress.org/support/topic-tag/html/)
 * [run](https://wordpress.org/support/topic-tag/run/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [convictedvapour](https://wordpress.org/support/users/chronicbubble/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/run-after-html-code/#post-8216130)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
