日期:2014-05-16 浏览次数:20717 次
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script type="text/javascript"> var data = []; $(function(){ $('tr').each(function(){ var x = $(this).find("td:first").html(); var y = $(this).find("th").html(); data.push({ x:x, y:y }); alert(x + " " + y) }) alert(data.length) }) </script> <table> <tbody> <tr> <td>1</td> <th>300</th> </tr> <tr> <td>2</td> <th>400</th> </tr> </tbody> </table>