Stopwatch laptime + sending times to database

Hello i am making a stopwatch but i dont have any idea how to make a laptime for my stopwatch

js code

   function init() {`
            var stopwatch1 = new Timer("timerLabel1", "start1");
            document.getElementById("start1").onclick = function(){
                stopwatch1.start();
            }
            document.getElementById("reset1").onclick = function(){
                stopwatch1.reset();
            }
             
            var stopwatch2 = new Timer("timerLabel2", "start2");
            document.getElementById("start2").onclick = function(){
                stopwatch2.start();
            }
            document.getElementById("reset2").onclick = function(){
                stopwatch2.reset();
            }
             
            var stopwatch3 = new Timer("timerLabel3", "start3");
            document.getElementById("start3").onclick = function(){
                stopwatch3.start();
            }
            document.getElementById("reset3").onclick = function(){
                stopwatch3.reset();
            }
             
             
            document.getElementById("moveAllBtn").onclick = function(){
                 
                if (document.getElementById("moveAllBtn").value == 'START') {
                    stopwatch1.status = 0;
                    stopwatch2.status = 0;
                    stopwatch3.status = 0;
                     
                } else {
                    stopwatch1.status = 1;
                    stopwatch2.status = 1;
                    stopwatch3.status = 1;
                }
                 
                stopwatch1.start();
                stopwatch2.start();
                stopwatch3.start();
                 
            }       
             
        }
         
         
        function Timer(timerLabelId, startBtnId) {
            this.status = 0;
            this.time = 0;
            this.timerLabel = document.getElementById(timerLabelId);
            this.startBtn = document.getElementById(startBtnId);
        }
         
        Timer.prototype.start = function() {
             
            if (this.status == 0) {
                this.status = 1;
                this.startBtn.value = "STOP";
                this.count();
                 
            } else {
                this.status = 0;
                this.startBtn.value = "START";
  
            }           
        }
         
        Timer.prototype.count = function() {
             
            if (this.status == 1) {
                var that = this;
                setTimeout(function(){
                    that.time++;
                    that.timerLabel.innerHTML = getTime(that.time);
                    that.count();
                }, 10);
                document.getElementById("moveAllBtn").value = 'STOP';
                 
            } else {
                document.getElementById("moveAllBtn").value = 'START';
            }
        }
         
        Timer.prototype.reset = function() {
            this.status = 0;
            this.time = 0;
            this.startBtn.value = "START";
            this.timerLabel.innerHTML = "00:00.00";
        }
         
         
        function getTime(time) {
             
            var min = Math.floor(time/100/60);
            var sec = Math.floor(time/100);
            var mSec = time%100;
             
            if (min < 10) {
                min = "0" + min;
            }
            if (sec >= 60) {
                sec = sec % 60;
            }
            if (sec < 10) {
                sec = "0" + sec;
            }
             
            return min + ":" + sec + "." + mSec;
             
        }
        
            
        
         
        init();
        }`

i want to post this time on screen and send it to my mysql database any tips ?

HTML code please.

<!DOCTYPE html>
<html lang="ja">
<head>
    
    <meta charset="utf-8">
    <title>Simulatie</title>
    <link href='https://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>
     <link rel='stylesheet' type='text/css' href="Stopcss.css">
</head>
<body>
  
    <div class="nav"><img src="https://www.techne.be/wp-content/themes/techneit/assets/img/logo.png" alt="logo"></div>
    <div class="topbar"><div class="topbar">
				<a href="http://yennick.xyz/Gip/">Home</a>
				<a href="./stats_werknemer.php">Individueel</a>
				<a class="active"href="./index.php">stopwatch</a>
				
			</div></div>
<div class="container">
    <h1>simulatie</h1>
    <br><br>
    <table border="1" cellspacing="0" id="table01">
        <tr>
            <th>1</th>
            <th>2</th>
            <th>3</th>
        </tr>
        <tr>
            <td>
                <h2 id="timerLabel1">00:00.00</h2>
                <br>
                <input type="button" onclick="start_stop(this)" value="START" id="start1">
                <input type="button" onclick="reset(this)" value="RESET" id="reset1">
            </td>
            <td>
                <h2 id="timerLabel2">00:00.00</h2>
                <br>
                <input type="button" onclick="start_stop(this)" value="START" id="start2">
                <input type="button" onclick="reset(this)" value="RESET" id="reset2">
            </td>
            <td>
                <h2 id="timerLabel3">00:00.00</h2>
                <br>
                <input type="button" onclick="start_stop(this)" value="START" id="start3">
                <input type="button" onclick="reset(this)" value="RESET" id="reset3">

            </td>
        </tr>
    </table>
    <br><br>
    <table id="table02">
        <tr>
            <td><button onclick="location.href='index.php'" id="resetAllBtn">RESET</button></td>
            <td><input type="button" onclick="moveAll(this)" value="START" id="moveAllBtn"></td>
           
        </tr>
    </table>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.