How to to use an output result in a new calculation?

Viewed 49

I have a code with two calculations

x = a * b * e

and the sum from it (x) shall be added together with c and d

y = c + d + x

how do I do that? The other code I succeeded with, but not to get the sum of X to be added together with C and D

my code looks like below

<form oninput="x.value=(parseFloat(a.value.replace(',','.'))*parseFloat(b.value.replace(',','.'))*parseFloat(e.value.replace(',','.'))).toFixed(2).toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ' ').replace(/[.]/,',');y.value=(parseFloat(c.value.replace(',','.'))+parseFloat(d.value.replace(',','.'))+parseFloat(x.value.replace(',','.'))).toFixed(2).toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ' ').replace(/[.]/,',')">

  <table>
    <th colspan="2">
      bla bla bla
    </th>
    <tr>
      <td>
        <label for="a">bla bla:</label>
      </td>
      <td>
        <input type="number" id="a" value="24"><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="b">bla bla:</label>
      </td>
      <td>
        <input type="number" id="b" value="25"><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="c">bla bla:</label>
      </td>
      <td>
        <input type="number" id="c" value="500"><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="d">bla bla:</label>
      </td>
      <td>
        <input type="number" id="d" value="25"><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="e">bla bal:</label>
      </td>
      <td>
        <input type="number" id="e" value="25"><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="x"> ::</label>
      </td>
      <td>
        <output name="x" for="a b e"></output><br /><br />
      </td>
    </tr>
    <tr>
      <td>
        <label for="y" style="font-size:20px;color:red"> <b>Bla</b> ::</label>
      </td>
      <td>
        <b><output name="y" for="a b x"></output></b>

  </table>

0 Answers
Related