Interactions en Javascript

Publié le 25 avr. 2020 il y a 3A par slanistas29 - Fin › 28 avr. 2020 dans 3A
1

Sujet du devoir

 
 
LA QUESTION:
 
 
Faire un damier qui peut, en fonction des clics sur les boutons, être affiché de toutes les façons suivantes (ne vous occupez pas de l'écart entre chaque carreau)

 

 
 

 

 
 
 
 
 
 
 
 
 

 

 

Où j'en suis dans mon devoir

MON CODE:

 

function maFonction1(){

    document.getElementById("case1").style.backgroundColor="green";

}

 

function maFonction2(){

    document.getElementById("case3").style.backgroundColor="blue";

}

 

function maFonction3(){

    document.getElementById("case4").style.backgroundColor="gray";

}

 

 

 

function maFonction4(){

var choix = document.getElementsByClassName("classe1");

     choix[0].style.backgroundColor="gold";

     choix[1].style.backgroundColor="gold";

     choix[3].style.backgroundColor="gold";

}

 

function maFonction5(){

var numeroCase = document.getElementsByClassName("classe1");

     numeroCase[0].style.backgroundColor="black";

     numeroCase[1].style.backgroundColor="red";

     numeroCase[2].style.backgroundColor="red";

     numeroCase[3].style.backgroundColor="black";

}

 

function maFonction6(){

    document.getElementById("case3").style.backgroundColor="#01DF01";

    document.getElementById("case4").style.backgroundColor="#04B404";

var choix = document.getElementsByClassName("classe1");

     choix[0].style.backgroundColor="#64FE2E";

     choix[1].style.backgroundColor="#40FF00";

     choix[2].style.backgroundColor="#088A08";

     choix[3].style.backgroundColor="#0B610B";

 

}

 

 

 

CSS:

 

h5{ color: red;

}

 

p{

width : 100px;

height : 100px;

 

}

 

 




0 commentaire pour ce devoir



Ils ont besoin d'aide !

Il faut être inscrit pour aider

Crée un compte gratuit pour aider

Je m'inscrisOU

J'ai déjà un compte

Je me connecte