$liste[] = ''; for ($i = 12; $i < 37; $i++) { $liste[] = $i; }
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <title>Liste</title> </head> <body> <label for="maListe"></label><select name="maListe" id="maListe"></select> <script> for (let i = 12; i < 37; i++) { let option = document.createElement('option'); option.textContent = i.toString(); option.value = i.toString(); document.getElementById('maListe').appendChild(option); } </script> </body> </html>
6 févr. 2020 à 12:41