diff --git a/TD3/js/td3-exo1.js b/TD3/js/td3-exo1.js index f1ab6f1..1e74a61 100644 --- a/TD3/js/td3-exo1.js +++ b/TD3/js/td3-exo1.js @@ -16,11 +16,14 @@ function selection(event) { var maCase = event.currentTarget; var vide = document.body.querySelector(".case.vide"); - if ((maCase.offsetTop == vide.offsetTop && Math.abs(maCase.offsetLeft - vide.offsetLeft == 102)) || - (maCase.offsetLeft == vide.offsetLeft && Math.abs(maCase.offsetTop - vide.offsetTop == 102))) { - console.log("1"); + if ((maCase.offsetTop == vide.offsetTop && Math.abs(maCase.offsetLeft - vide.offsetLeft) == 102) || + (maCase.offsetLeft == vide.offsetLeft && Math.abs(maCase.offsetTop - vide.offsetTop) == 102)) { + console.log("ok"); maCase.className = "case vide"; + var buff = maCase.innerHTML; + maCase.innerHTML = ""; vide.className = "case"; + vide.innerHTML = buff; } console.log(event.currentTarget.className + " : " + event.currentTarget.innerText);