function removeTds() {
var elements = $('#goldBarList tr:not(:eq(0))').filter(':has(:checkbox:checked):lt(50)');
var count = elements.length;
elements.each(function() {
grossWeightTotal = grossWeightTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(8)').text();
netWeightTotal = netWeightTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(9)').text();
fineOunceTotal = fineOunceTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(10)').text();
});
elements.remove();
if(count === 50) window.setTimeout(removeTds, 1);
}
removeTds();
上面的代码导致“停止运行这个脚本?” 迅速的。我有 4000 条记录。