<html>
<meta charset='utf-8'>
<body>
<table border="1">
<tr>
<th>标题1</th>
<th>标题2</th>
<th>标题3</th>
</tr>
<tr>
<td>行1</td>
<td>100</td>
<td>100</td>
</tr>
<tr>
<td>行2</td>
<td>100</td>
<td>100</td>
</tr>
<tr>
<td>行3</td>
<td>100</td>
<td>100</td>
</tr>
</table>
<table border="1">
<tr>
<th>标题4</th>
<th>标题5</th>
<th>标题6</th>
</tr>
<tr>
<td>行1</td>
<td>123</td>
<td>asas</td>
</tr>
<tr>
<td>行2</td>
<td><input value='100'></td>
<td>100</td>
</tr>
<tr>
<td>行3</td>
<td>100</td>
<td>100</td>
</tr>
</table>
<select style='width:100px'>
<option> </option>
<option>a</option>
<option>b</option>
<option>c</option>
</select>
<button οnclick="a()">click</button>
<script src='http://apps.bdimg.com/libs/jquery/1.6.4/jquery.js'></script>
<script>
function a(){
//alert($(":selected").text());
console.log( $("select").html());
var a=' ';
if(a){alert(1)}else{alert(2)}
}
var obj = $('input');
var td = obj.parents('tr').find('td:nth-of-type(1)').html();
var tr = obj.parents('table').find('th:nth-of-type('+Number(obj.parents('td').index()+1)+')').html();
console.log(td+tr);
//alert( $('table:nth-of-type(1) tr:nth-of-type(1) th:nth-of-type(2)').html());
</script>
</body>
</html>
做项目用的小测试