它在td中作为.text起作用
<td>'.$row["j_pic"].'</td>
但不适用于td中的img
<td>'."<img src='picture/".($row["j_pic"])."' style='width:20%' />".'</td>
jQuery
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
$(document).ready(function() {
var span = 1;
var prevTD = "";
var prevTDVal = "";
$("#myTable tr td:first-child").each(function() { //for each first td in every tr
var $this = $(this);
if ($this.text() == prevTDVal) { // check value of previous td text
span++;
if (prevTD != "") {
prevTD.attr("rowspan", span); // add attribute to previous td $this.remove(); // remove current td
} } else {
prevTD = $this; // store current td
prevTDVal = $this.text();
span = 1; } }); });