JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div id="bouton">
<input type="button" name="bouton" value="Notation" />
</div>
</body>
JavaScript
(function(){
var exemple = {
init : function(){
window.addEventListener('load',function(event){
var bouton = document.getElementById('bouton');
bouton.addEventListener('click',function(event){
if (!document.getElementById('formulaire')){
var form = document.createElement('form');
form.action='devoir_2_demande_2.php';
form.id='formulaire';
form.method='POST';
var select = document.createElement('select');
select.id = 'choice';
select.name='note_classique';
form.appendChild(select);
document.body.appendChild(form);
// Génération du tableau de corrspondance des notes de musique
var notes = [['Faites votre choix', 'Do', 'Ré', 'Mi', 'Fa', 'Sol', 'La', 'Si'], ['', 'C', 'D', 'E', 'F', 'G', 'A', 'B']];
notes[0].forEach(function(valeur,index){
var option = new Option(valeur,index);
select.appendChild(option);
});
}
});
});
}
};
exemple.init();
})();