<table id="mytable" border=1 style='width:100%;text-align:center'>
<thead>
<tr>
<th>名称</th>
<th>数量</th>
</tr>
</thead>
<tbody>
<tr><td>鱼</td><td><input type='text'></td></tr>
<tr><td>肉</td><td><input type='text'></td></tr>
<tr><td>酒</td><td><input type='text'></td></tr>
<tr><td>菜</td><td><input type='text'></td></tr>
</tbody>
</table>
<br />
<button>show result</button>
<br />
<span id="result"></span>
xxxxxxxxxx
var food = {}
$("button").click(function(){
food={}
$("span").text("")
$("#mytable tbody tr").each(function(){
var key = $(this).children("td").eq(0).text()
var value = $(this).find("input").val()
food[key]=value
})
for(key in food){
$("span").append(key+":"+food[key]+"||")
}
})