<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js双击table中的行得到行内信息-www.jb200.com</title>
<script language="
javascript">
function clickTR(n)
{
var a=document.getElementById("td"+n+"1").innerText;
var b=document.getElementById("td"+n+"2").innerText;
var c=document.getElementById("td"+n+"3").innerText;
var d=document.getElementById("td"+n+"4").innerText;
alert("编号:"+a+"n姓名:"+b+"n性别:"+c+"n年龄:"+d);
}
</script>
</head>
<body>
<table width="98%" border="1" cellspacing="0" cellpadding="0">
<tr align="center">
<td width="25%">编号</td>
<td width="25%">姓名</td>
<td width="25%">性别</td>
<td width="25%">年龄</td>
</tr>
<tr align="center" onclick="clickTR(1);">
<td id="td11">1</td>
<td id="td12">王中央</td>
<td id="td13">男</td>
<td id="td14">23</td>
</tr>
<tr align="center" onclick="clickTR(2);">
<td id="td21">2</td>
<td id="td22">赵四娣</td>
<td id="td23">女</td>
<td id="td24">32</td>
</tr>
</table>
</body>
</html>