From 59feb57f7e9d3924e710fc00699ab177ef3678a0 Mon Sep 17 00:00:00 2001
From: muktar1907 <muktar1907@gmail.com>
Date: Wed, 24 Apr 2024 01:25:11 -0500
Subject: [PATCH] onclick

---
 html/index.html | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/html/index.html b/html/index.html
index 9c97d51..070ac70 100644
--- a/html/index.html
+++ b/html/index.html
@@ -211,16 +211,23 @@ <h1>The Word Search Game</h1>
         document.body.appendChild(tbl);
         tbl.setAttribute("border","1.5");
     }
-
-    function buttonClick(cell,action)
+    var cells = document.querySelectorAll("td");
+    for(var i=0;i<cells.length;i++)
+    {
+        cells[i].addEventListener("click",buttonEvent(cells[i].getAttribute("id"),0));
+        cells[i].addEventListener("mouseover",buttonEvent(cells[i].getAttribute("id"),1));
+    }
+    function buttonEvent(cell,action)
     {
+        const button= document.getElementById(cell.toString());
+        button.style.backgroundColor="blue";
         U = new UserEvent();
         U.cell=cell;
         U.action=action;
         U.player=player;
         U.gameId=gameId;
 
-        socket.send(JSON.stringify(U));
+        //socket.send(JSON.stringify(U));
         console.log(JSON.stringify(U));
     }
 </script>