This commit is contained in:
Blavignac Leonardo 2022-12-12 09:33:12 +01:00
parent a4152b4529
commit c0d19b4414
2 changed files with 33 additions and 28 deletions

View file

@ -71,37 +71,37 @@
<div class="clavier">
<div class="line1">
<!--la fonction update sera la fonction qui écrit la lettre dans la grille quand on clique dessus-->
<button type="button Q" onclick="update('Q')">Q</button>
<button type="button W" onclick="update('W')">W</button>
<button type="button E" onclick="update('E')">E</button>
<button type="button R" onclick="update('R')">R</button>
<button type="button T" onclick="update('T')">T</button>
<button type="button Y" onclick="update('Y')">Y</button>
<button type="button U" onclick="update('U')">U</button>
<button type="button I" onclick="update('I')">I</button>
<button type="button O" onclick="update('O')">O</button>
<button type="button P" onclick="update('P')">P</button>
<button type="button" id="Q" onclick="update('Q')">Q</button>
<button type="button" id="W" onclick="update('W')">W</button>
<button type="button" id="E" onclick="update('E')">E</button>
<button type="button" id="R" onclick="update('R')">R</button>
<button type="button" id="T" onclick="update('T')">T</button>
<button type="button" id="Y" onclick="update('Y')">Y</button>
<button type="button" id="U" onclick="update('U')">U</button>
<button type="button" id="I" onclick="update('I')">I</button>
<button type="button" id="O" onclick="update('O')">O</button>
<button type="button" id="P" onclick="update('P')">P</button>
</div>
<div class="line2" style="padding-left: 22px;">
<button type="button A" onclick="update('A')">A</button>
<button type="button S" onclick="update('S')">S</button>
<button type="button D" onclick="update('D')">D</button>
<button type="button F" onclick="update('F')">F</button>
<button type="button G" onclick="update('G')">G</button>
<button type="button H" onclick="update('H')">H</button>
<button type="button J" onclick="update('J')">J</button>
<button type="button K" onclick="update('K')">K</button>
<button type="button L" onclick="update('L')">L</button>
<button type="button" id="A" onclick="update('A')">A</button>
<button type="button" id="S" onclick="update('S')">S</button>
<button type="button" id="D" onclick="update('D')">D</button>
<button type="button" id="F" onclick="update('F')">F</button>
<button type="button" id="G" onclick="update('G')">G</button>
<button type="button" id="H" onclick="update('H')">H</button>
<button type="button" id="J" onclick="update('J')">J</button>
<button type="button" id="K" onclick="update('K')">K</button>
<button type="button" id="L" onclick="update('L')">L</button>
</div>
<div class="line3">
<button style="width:67px;" type="button" onclick="Enter()">ENTER</button>
<button type="button Z" onclick="update('Z')">Z</button>
<button type="button X" onclick="update('X')">X</button>
<button type="button C" onclick="update('C')">C</button>
<button type="button V" onclick="update('V')">V</button>
<button type="button B" onclick="update('B')">B</button>
<button type="button N" onclick="update('N')">N</button>
<button type="button M" onclick="update('M')">M</button>
<button type="button" id="Z"onclick="update('Z')">Z</button>
<button type="button" id="X"onclick="update('X')">X</button>
<button type="button" id="C"onclick="update('C')">C</button>
<button type="button" id="V"onclick="update('V')">V</button>
<button type="button" id="B"onclick="update('B')">B</button>
<button type="button" id="N"onclick="update('N')">N</button>
<button type="button" id="M"onclick="update('M')">M</button>
<button style="width:68px;" type="button" onclick="Supprimer()">SUPPR</button>
</div>

View file

@ -37,13 +37,13 @@ function key_color_good_letter(key){
key_div.style.backgroundColor = good_letter_color;
}
function key_color_bad_letter(coord){
function key_color_bad_letter(key){
console.log(key)
var key_div = document.getElementById(key);
key_div.style.backgroundColor = bad_letter_color;
}
function key_color_mid_letter(coord){
function key_color_mid_letter(key){
console.log(key)
var key_div = document.getElementById(key);
key_div.style.backgroundColor = mid_letter_color;
@ -86,10 +86,15 @@ function verifLettres() {
for(let i=0 ; i<5; i++){
if(word[i]==reponse[i]){
verif[i]=2;
key_color_good_letter(word[i].toUpperCase());
}
else{
if(reponse.includes(word[i])){
verif[i]=1;
key_color_mid_letter(word[i].toUpperCase());
}
else {
key_color_bad_letter(word[i].toUpperCase());
}
}
}