ICI header("Location: http://www.mytesting.fr ");

FABRIQUER SON CHRONOMETRE

par André MARINI 17 Septembre 2021, 09:20 Astuces de blogueur

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Minuterie en JS</title>
<style type="text/css">
body{
	font-family: Arial, Helvetica, sans-serif;
	font-size: 10pt;
	}
</style>
<script type="text/javascript">
var compteur = 1;
var interv;
var encours;

function incrementer()
{
	compteur++;
	document.formulaire.heure.value=compteur;
}

function appui()
{
	if(encours == 1)
	{
		clearInterval(interv);
		document.formulaire.bouton.value = "Reprendre";
		encours = 0;
	}
	else 
	{
		interv = setInterval("incrementer()",100);
		document.formulaire.bouton.value = "Arrêter";
		encours = 1;
	}
}

function init()
{
	// (pas de démarrage auto) interv = setInterval("incrementer()",100);
	document.formulaire.bouton.value = "Commencer";
}
</script>
</head>

<body onload="init();">
<h2>Un compteur en JS</h2>
<form name="formulaire">
<input type="text" value="" name="heure" onclick="incrementer();"/>
<input type="button" value="Arreter" onclick="appui();" name="bouton" />
</form>

</body>
</html>
Minuterie en JS

Un compteur en JS

Haut de page