Skip to content

Commit

Permalink
events
Browse files Browse the repository at this point in the history
  • Loading branch information
muktar1907 committed Apr 24, 2024
1 parent f912205 commit 1742189
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,15 @@ <h1>The Word Search Game</h1>
tbl.appendChild(tblBody);
document.body.appendChild(tbl);
tbl.setAttribute("border","1.5");

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));
}
}
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());
Expand Down

0 comments on commit 1742189

Please sign in to comment.