The example of this article describes the way JS gets the TD value in table. Share to everyone for your reference. Specifically as follows:
1, when you want to get multiple lines of any TD, the use of each TD to set a common class
Copy Code code as follows:
<tr>
<TD style= "Display:none" id= "TD2" >002</td>
<TD style= "Text-align:left;text-decoration:underline" id= "TD2" class= "Mouse_hover" > Love Flow app Internet promotion </td>
<TD style= "Text-align:left;" > Group Marketing Department </td>
<TD style= "Text-align:left;" >2015-3-16</td>
<TD style= "Text-align:left;" >2015-3-25</td>
<TD style= "Text-align:center;" >11</td>
<td></td>
</tr>
In the initialization method:
$ (document). Ready (function () {
$ (". Mouse_hover"). Click (function () {
//$ (this). context.innerhtml//Same effect
Alert ($ (this). text ());
Alert ("222" + $ (this). context.innertext);
})
;
2, fixed TD take value, set TD ID:
document.getElementById (' TD1 '). InnerHTML
I hope this article will help you with your JavaScript programming.