Clear field after X time

3

I have the form below, which after 2 minutes it updates the entire page:

Withthecommandbelow:

<metaHTTP-EQUIV="refresh" CONTENT="120;URL=http://pcn-sig.peccin.local/cracha">

And with this it resets the form on each access:

<body class="noheader" onload="moveRelogio(); getInfo(); document.cadastro.reset()">

But I'm having a problem, because the machines given for this application are very slow, K6 2 500 down, and in some the page takes 5 to 10 seconds to open, and here I tested does not take 1 second. How could I just "clean" the badge field instead of the entire page?

Form Excerpt:

          <form id="cadastro" name="cadastro" method="POST" action="adicionaBatida.php" autocomplete="off">
            <table cellspacing="0">

              <tr>
                  <td>Data:</td>
                  <td><input type = "text" style="font-family: Verdana, Geneva, sans-serif; height: 40px; font-size: 30px;" readonly="true" id="data_inicio" name = "data_inicio" size = 12 maxlength =10  value= "<? echo date('d-m-Y');?>" ></td>
              </tr>
              
              <tr>
                  <td>Hora Atual:</td>
                  <td><input type = "text" style="font-family: Verdana, Geneva, sans-serif; height: 40px; font-size: 30px;" readonly="true" id="hora_inicio" name = "hora_inicio" size = 12></td>
              </tr>

              <tr>
                 <td>Crachá: </td>
                 <td><input type = "password" name="cracha" id="cracha" placeholder="Passe o crachá..." size = 15 maxlength = 10 onChange="getDados();" onkeyup="troca_campo(this)"  onkeypress="return SomenteNumero(event)" autofocus></td>
              </tr>


              <? // EXIBE O NOME ?>
              <tr>
                 <td></td>
                 <td><textarea cols="25" rows="10" wrap="hard" style="font-family: Verdana, Geneva, sans-serif; height: 80px; font-size: 30px;" id="nome" name="nome" placeholder="Aguardando crachá..." size="35" readonly="true"></textarea></td>
               </tr>
    
asked by anonymous 27.01.2016 / 17:06

1 answer

3
function LimpaCracha(){
    document.getElementById('cracha').value = '';
}

setInterval(function(){
    LimpaCracha();
}, 10 * 1000);
  

where 10 is the number of seconds.

Cleaned every 10 seconds.

    
27.01.2016 / 17:15