function checkFirstClick(){ if(typeof firstClick !== "undefined"){ return true; }else{ firstClick = 1; return false; } }
<script type="text/javascript"> function checkNBclic(){ var nbClic = document.getElementById('nbclic'); console.log (nbClic.value); if(nbClic.value>0){ document.form.submit(); }else{ nbClic.value = 1; return false; } } </script> <form method="post" action="unpage.php" onsubmit="return checkNBclic()";> <input type="hidden" id="nbclic" value="0"> <input type="submit" value="valider"> </form>
<script type="text/javascript"> function checkNBclic(){ var nbClic = document.getElementById('nbclic'); alert(nbClic.value); if(nbClic.value>0){ document.maform.submit(); }else{ nbClic.value = 1; return false; } } </script> <form id='maform' name='maform' method="post" action="unpage.php" > <input type="hidden" id="nbclic" value="0"> <input type="button" value="valider" onclick="checkNBclic()";> </form>