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
| window.onload = function() {
document.getElementById("titre").innerHTML='<p> Notation classique notation américaine </p>';
noteAmericaine=["C","D","E","F","G","A","B","C"];
selectNote=['Choisir...','Do','Ré','Mi','Fa','Sol','La','Si'];
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*/
var select=document.createElement('select');/*Création du select*/
select.id='sel';
span.innerHTML='Choisissez la note classique à convertir en note américaine : ';
form.appendChild(span);
span.appendChild(select);
for (var i=0; i<=7; i++){
var option=document.createElement('option');/*Création des options*/
option.value=selectNote[i];
option.innerHTML=selectNote[i];
select.appendChild(option);
}
}
function fonctionValider(){
var sel = document.getElementById('sel');
var IndexNoteChoisi = sel.options[sel.selectedIndex];
alert(noteAmericaine[IndexNoteChoisi]);
for (var j=0; j<=7; j++){
if(IndexNoteChoisi == noteAmericaine[j]){
alert('La note classique correspond à la note américaine .');
}
}
} |
Partager