这个页面是点击表格弹出表格内文本的js做法
<html>
<head>
<title>My JSP 'failure.jsp' starting page</title>
</head>
<script type="text/javascript">
function alt(){
var obj=document.getElementById("tb").getElementsByTagName("td");
for(var i=0;i<obj.length;i++){
obj[i].οnclick=function(){
alert(this.innerText);
};
}
}
</script>
<body>
<table οnclick="alt()" id="tb" border="1" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="yellow">
<td>编号</td>
<td>姓名</td>
<td>性别</td>
<td>年龄</td>
</tr>
<tr>
<td bgcolor="pink">1</td>
<td>aaaa</td>
<td>G </td>
<td>21</td>
</tr>
<tr>
<td bgcolor="pink">2</td>
<td>vasd</td>
<td>M </td>
<td>23</td>
</tr>
<tr>
<td bgcolor="pink">3</td>
<td>ewrww</td>
<td>M </td>
<td>26</td>
</tr>
<tr>
<td bgcolor="pink">4</td>
<td>qqw</td>
<td>G </td>
<td>24</td>
</tr>
</table>
</body>
</html>