下面是我的代码
<tbody>
<?php
if($query->rowCount() > 0)
{
while($row = $query->fetch(PDO::FETCH_ASSOC))
{
?>
<tr class="rows">
<td class='f_name'><?php echo $row['fullnames']; ?></td>
<td>
<input type="text" class='avg' value="<?php echo $row['average']; ?>">
</td>
<td><input type='text' class='grade' value=""></td>
</tr>
<?php
}
}else {echo "No Records Found";}
?>
</tbody>
我希望每个平均数都有相应的分数。下面是我的javascript代码
$(function(){
var rw = $('.avg').val();
var st;
if(rw >= 80.00 && rw <= 100){st = 'Excellent';}
else if(rw >= 70.00 && rw <= 79.99){st = 'Very Good';}
else if(rw >= 60.00 && rw <= 69.99){st = 'Good';}
else if(rw >= 50.00 && rw <= 59.99){st = 'Credit';}
else if(rw >= 40.00 && rw <= 49.99){st = 'Passed';}
else if(rw >= 0.00 && rw <= 39.99){st = 'Failed';}
else {st = 'No Grade';}
$('.cposts').val(st);
});
拜托,我做错什么了
1条答案
按热度按时间m1m5dgzv1#
它以类的所有元素为目标。但您只需要对该行和同一行中相应的元素进行排序。每
<tr>
,我会按行: