<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>姓 名</title>
<script language="javascript" type="text/javascript">
function getValues()
{
var obj=document.getElementById("table1").childNodes[0].childNodes
for(var i=1;i<obj.length;i++)
{
alert(obj[i].childNodes[2].childNodes[0].value)
}
}
</script>
</head><body>
<form name="" action="" method="post">
<table border="1" width="100%" id="table1" id="table1">
<tr>
<td width="180" align="center">姓 名</td>
<td width="223" align="center">年 龄</td>
<td align="center">职 业</td>
</tr>
<tr>
<td width="180" height="20" align="center">小 李</td>
<td width="223" height="20" align="center">22</td>
<td height="20" align="center"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="180" align="center">小 王</td>
<td width="223" align="center">21</td>
<td align="center"><input type="text" name="T2" size="20"></td>
</tr>
</table>
<p><button name="B3" onclick="getValues()">获得值</button></p>
</form>
</body>
</html>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>姓 名</title>
<script language="javascript" type="text/javascript">
function getValues()
{
var obj=document.getElementById("table1").childNodes[0].childNodes
for(var i=1;i<obj.length;i++)
{
alert(obj[i].childNodes[2].childNodes[0].value)
}
}
</script>
</head><body>
<form name="" action="" method="post">
<table border="1" width="100%" id="table1" id="table1">
<tr>
<td width="180" align="center">姓 名</td>
<td width="223" align="center">年 龄</td>
<td align="center">职 业</td>
</tr>
<tr>
<td width="180" height="20" align="center">小 李</td>
<td width="223" height="20" align="center">22</td>
<td height="20" align="center"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="180" align="center">小 王</td>
<td width="223" align="center">21</td>
<td align="center"><input type="text" name="T2" size="20"></td>
</tr>
</table>
<p><button name="B3" onclick="getValues()">获得值</button></p>
</form>
</body>
</html>
function getValues()
{
//弹出你输入的值
alert(document.frm.T1.value);
alert(document.frm.T2.value);
}
</script>
</head><body>
<form name="frm" action="" method="post"><!--此处给form命个名字-->
<table border="1" width="100%" id="table1">
<tr>
<td width="180" align="center">姓 名</td>
<td width="223" align="center">年 龄</td>
<td align="center">职 业</td>
</tr>
<tr>
<td width="180" height="20" align="center">小 李</td>
<td width="223" height="20" align="center">22</td>
<td height="20" align="center"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="180" align="center">小 王</td>
<td width="223" align="center">21</td>
<td align="center"><input type="text" name="T2" size="20"></td>
</tr>
</table>
<p><button name="B3" onclick="getValues()">获得值</button></p>
</form>
</body>
</html>