html: Copy code The code is as follows: Demo Dynamic table: script: Copy code The code is as follows: <br>function getColumnDetail(column){ <br>column.style.color = "blue"; //Set the clicked cell to blue Color<br>alert(column.innerHTML); //Pop up the content of the clicked cell<br>} <br><!--trLineNumber is the number of rows in the dynamic table, tdData is the data of each row of cells in the dynamic table , the data type is array--> <br>function setTable(trLineNumber,tdData){ <br>var _table = document.getElementById("table"); <br>var _row; <br>var _cell; <br> for (var i = 0; i < trLineNumber; i ) { <BR>_row = document.createElement("tr"); <BR>document.getElementById("table").appendChild(_row); <BR>for (var j = 0; j < tdData.length; j ) { <BR>_cell = document.createElement("td"); <BR>_cell.onclick= function(){getColumnDetail(this)}; // is Add a click event to each cell <BR>_cell.innerText = tdData[j]; <BR>_row.appendChild(_cell); <BR>} <br><br>} <BR>} <BR>< /script> <br> </div> <br>Call the setTable(trLineNumber,tdData) function to dynamically generate a table, and set a click event for each cell. After triggering, the clicked cell will pop up. content, while the data turns blue