window.onload=function(){ const facileBtn=document.getElementById("boutonF"); const moyenBtn=document.getElementById("boutonM"); const difficileBtn=document.getElementById("boutonD"); function changeEnFacile(){ console.log("ca marche") document.getElementById("calcul").innerHTML="c'est facile"; } function changeEnMoyen(){ console.log("ca marche") document.getElementById("calcul").innerHTML="c'est moyen"; } function changeEnDifficile(){ console.log("ca marche") document.getElementById("calcul").innerHTML="c'est difficile"; } facileBtn.addEventListener('click',changeEnFacile); moyenBtn.addEventListener('click',changeEnMoyen); difficileBtn.addEventListener('click',changeEnDifficile); }
<script src="file.js">
<script src="file.js"></script> // you can write it between 'head' tags, or in 'body' tag
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)