此代码可以正常工作,但是我的多个输入具有相同的ID和名称。我认为多条语句无法识别其他ID。
while($d = mysqli_fetch_array($data)){
?>
<tr>
<td align="text-center"><?php echo $no++; ?></td>
<td align="text-center"><input type="text" name="naran[]" value="<?php echo $d['naran'];?>"></td>
<td align="text-center"><input type="hidden" name="kode_sasan[]" value="<?php echo $d['kode_sasan'];?>"></td>
<td align="text-center"><input type="number" name="hamutuk[]" onfocus="sr()" onblur="psr()" id="hamutuk" ></td>
<td align="text-center"><input type="number" name="total[]" id="total" ></td>
<td align="text-center"><input type="hidden" value="<?php echo $d['folin_faan'];?>" name="folin_faan[]" onfocus="sr()" onblur="psr()" id="folin_faan""></td>
<td><a href="update.php?edit=<?php echo $d['id']; ?>"" type="button" class="btn btn-info glyphicon glyphicon-pencil"></a>
<a onclick="return confirm('Ita boot Hakarak Duni atu hamos?')" href="hamosfaan.php?hms=<?php echo $d['kode_sasan']; ?>" type="button" class="btn btn-danger glyphicon glyphicon-remove"></a>
</td>
</tr>
<?php } ?>
</table>
<button type="submit" name="sosa" class="btn btn-primary ">Processa</button>
</form>
<script type="text/javascript">
function kms(){
Interval = setInterval ("sr()",1);
}
function sr(){
folin_faan=parseFloat(document.getElementById("folin_faan").value);
hamutuk=parseFloat(document.getElementById("hamutuk").value);
total = folin_faan * hamutuk;
document.getElementById("total").value=total.toFixed(2);
}
function psr(){
clearInterval(Interval);
}
</script>
答案 0 :(得分:0)
请勿使用相同的ID。 您可以使自己的ID唯一。在while循环中,您可以操纵ID。
例如
<logger name="reactor.netty.http.server.AccessLog" level="INFO" additivity="false">
<AppenderRef ref="ACCESS_LOG"/>
</logger>