How to add 5 minute javascript countdown timer which submit a form

后端 未结 5 436
深忆病人
深忆病人 2021-01-03 12:27

I want to add 5 minute countdown timer which submit a form to my php page.

        
5条回答
  •  离开以前
    2021-01-03 12:43

    Hope this helps

    var trig = setInterval(timer,1000);
    
        var counter=0;
        var min=4;
        var sec=60;
    
        function timer(){
    
        sec=--sec;
    
        if(sec===0){
        min=--min;
        sec=59;
        counter=++counter;
        }
    
        if(counter===5){
        sec=0;
        min=0;
        clearInterval(trig);
         functionSubmit();
         document.write("Submitted");
         }
    
         document.getElementById("output").innerHTML = min+" : "+sec;
    
         }

    Autosubmit in

提交回复
热议问题