arsiarne

onclick form submit

Mar 21st, 2015
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script>
  2.     <!--
  3.     //
  4.      var detik=20;
  5.      var menit=1;
  6.      //document.counter.d2.value='30'
  7.    
  8.     function display()
  9.     {
  10.         if (menit==0&&detik==0) {
  11.             alert('Waktu habis');
  12.             document.getElementById('form1').submit();
  13.         }
  14.    
  15.      if (detik<=0){
  16.         detik=60;
  17.         menit-=1;
  18.      }
  19.      if (menit<=-1){
  20.         detik=0;
  21.         menit+=1;
  22.      }
  23.      else
  24.         detik-=1
  25.        
  26.         detik="" + detik
  27.         menit="" + menit
  28.         var pad = "00"
  29.         document.getElementById("menit").innerHTML=pad.substring(0, pad.length - menit.length) + menit;
  30.         document.getElementById("detik").innerHTML=pad.substring(0, pad.length - detik.length) + detik;
  31.         //document.counter.d2.value=menit;
  32.         //document.counter.d3.value=detik;
  33.         setTimeout("display()",1000)
  34.     }
  35.     display()
  36.     -->
  37.     </script>
Advertisement
Add Comment
Please, Sign In to add comment