1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
   | <html>
<head>
<title>setInterval/clearInterval example</title>
 
<script type="text/javascript">
var intervalID;
 
function changeCouleur()
{
  intervalID = setInterval(flashText, 1000);
}
 
function flashText()
{
  var elem = document.getElementById("ma_boite");
  if (elem.style.color == 'red')
  {
    elem.style.color = 'blue';
  }
  else
  {
    elem.style.color = 'red';
  }
}
 
 
</script>
</head>
 
<body onload="changeCouleur();">
<div id="ma_boite">
<p>Salut tout le monde</p>
</div>
 
</body>
</html> | 
Partager