meta données pour cette page
  •  

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

exemple_do_while [2014/09/17 15:04] – créée André Girardexemple_do_while [2014/09/17 15:05] (Version actuelle) André Girard
Ligne 2: Ligne 2:
  
 <sxh js; html-script: true> <sxh js; html-script: true>
 +<!DOCTYPE html>
 +<html>
 +<body>
 +
 +<p>Click the button to loop through a block of code as long as i is less than 10.</p>
 +
 +<button onclick="myFunction()">Try it</button>
 +
 +<p id="demo"></p>
 +
 +<script>
 +function myFunction() {
 +    var text = "";
 +    var i = 10;
 +    do {
 +        text += "<br>The number is " + i;
 +        i++;
 +    }
 +    while (i < 10);  
 +    document.getElementById("demo").innerHTML = text;
 +}
 +</script>
 +
 +</body>
 +</html>
  
 </sxh> </sxh>