</div></td>
</tr>
<tr>
<td><span onclick="wtrecodes(4,2);" id="nf_4" class="" style="font-size: 90%; min-width: 10.8px; min-height: 18px;" box="1">2</span></td>
</tr>
</tbody>
</table>
<font style="top:-25px;">x</font>
<font style="top:-25px;">-</font>
<font style="top:-25px;">+</font>
<font style="top:-25px;">×</font>
<font style="top:-25px;">÷</font>
<font style="top:-25px;">=</font>
</span>
</div>
我想遍历一遍,重新修改标签里的top值,使其能够垂直居中,
jquery代码如下,不知道为啥不能重新改值:
$("#matypalayerhide span").each(function(event) {
var fatherid = $(this).attr("id");
var fc = $("#"+fatherid).height();
var averageHeight= parseInt(fc / 2);
$("#"+fatherid).children("font").css("top","-"+averageHeight+"px");
//event.stopPropagation(); // 阻止点击事件冒泡到父级元素
});