-4

合計値の概数を取得する方法

現在、このように表示されてい ます http://www.koolfree.com/ImageUpload/uploads/1380114018.jpg

そして私はそれが欲しい http://www.koolfree.com/ImageUpload/uploads/1380160965.jpg

この問題を解決するのを手伝ってくださいありがとう

<script type="text/javascript"><!--
function updatesum() {
document.form.sum.value = (document.form.sum1.value -0) / (document.form.sum2.value -0);
}
//--></script>

<body>

<form name="form" >
Enter a number:
<input name="sum1" onChange="updatesum()" />
and another number:
<input name="sum2" onChange="updatesum()" />
Their sum is:
<input name="sum" readonly style="border:0px;">
</form>

</body>
4

3 に答える 3

0

これはうまくいくはずです。

function updatesum() {
    var sum = (document.form.sum1.value -0) / (document.form.sum2.value -0);
    document.form.sum.value = sum.toFixed(3);
}
于 2013-09-25T12:29:48.463 に答える