0

html

<input type="text" id="txt1"  onChange="sum();" />
<input type="text" id="txt2"  onChange="sum();" />
<input type="text" id="txt3"   onChange="sum2();" readonly/>
<input type="text" id="txt4"  onChange="sum1();" />
<input type="text" id="txt5"  onChange="sum1();" readonly/>
<input type="text" id="txt6"  onChange="sum2();" readonly/>
<input type="text" id="txt7" />

javascript

function sum() {
            var txtFirstNumberValue = document.getElementById('txt1').value;
            var txtSecondNumberValue = document.getElementById('txt2').value;
            var result = parseInt(txtFirstNumberValue) + parseInt(txtSecondNumberValue);
            if (!isNaN(result)) {
                document.getElementById('txt3').value = result;
            }
        }
function sum1() {
            var txtFirstNumberValue = document.getElementById('txt4').value;
            var txtSecondNumberValue = document.getElementById('txt5').value;
            var result = parseInt(txtFirstNumberValue) + parseInt(txtSecondNumberValue);
            if (!isNaN(result)) {
                document.getElementById('txt6').value = result;
            }
        }
function sum2() {
            var txtFirstNumberValue = document.getElementById('txt3').value;
            var txtSecondNumberValue = document.getElementById('txt6').value;
            var result = parseInt(txtFirstNumberValue) + parseInt(txtSecondNumberValue);
            if (!isNaN(result)) {
                document.getElementById('txt7').value = result;
            }
        } 

这是我使用的代码我没有获得 txt7 的价值如何获得这个价值有人可以帮助我吗。没有任何东西进入 txt7 文本框我需要获得 txt3 和 txt4 附加值的值

4

1 回答 1

0

onLoad="total_advertising()"?

于 2013-09-05T09:50:47.560 回答