gpt4 book ai didi

javascript - html表格内的计算

转载 作者:太空宇宙 更新时间:2023-11-03 20:29:49 26 4
gpt4 key购买 nike

我正在做一个元素,我需要在 html 表中计算一些数字。他们需要查看最终金额。有没有其他方法可以在不使用 <input> 的情况下计算该值标签。如果我使用 ,显示将变成框内框,如下图所示: enter image description here

我的代码如下:

<tr oninput="Total-dep.value=parseInt(Dep-main.value)+parseInt(Dep-joint1.value)">
<td>No. of Dependant(s)</td>
<td contenteditable="true" id="Dep-main" value="0"></td>
<td contenteditable="true" id="Dep-joint1" value="0"></td>
<td contenteditable="true" name="Total-dep" for="Dep-main Dep-joint1" value=""></td>
</tr>

当前显示结果如下: enter image description here

我想用前两列相加,然后在最后一列求和。

最佳答案

您可以使用 css 隐藏输入文本字段的边框。

{
border: none;
outline: none;
box-shadow: none;
}

关于javascript - html表格内的计算,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44782991/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com