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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| window.onload = function() {
document.getElementById("titre").innerHTML='<p> Notation classique notation américaine </p>';
note={'Choisir...':'error','Do':'C','Ré':'D','Mi':'E','Fa':'F','Sol':'G','La':'A','Si':'B'};
var form=document.createElement('form');/*Création du formulaire*/
form.id='liste';
form.name='liste';
titre.appendChild(form);
var span=document.createElement('span');/*Création du span*/
span.innerHTML='Choisissez la note classique à convertir en note américaine : ';
var select=document.createElement('select');/*Création du select*/
select.name='selname';
select.id='sel';
select.onchange='fonctionValider()';
for (var i in note)
{
var option=document.createElement('option');/*Création des options*/
option.value=i;
option.innerHTML=i;
select.appendChild(option);
}
form.appendChild(span);
span.appendChild(select);
}
function fonctionValider(){
var selec = document.getElementById('sel');
var nomNoteChoisi = selec.options[selec.selectedIndex].value;
alert(nomNoteChoisi);
for(i in note){
if(nomNoteChoisi==i){
alert('La note classique '+nomNoteChoisi+' correspond à la note américaine '+note[i]+' .');
}
}
} |