sumbit transferable output and multiplying by decimal place



  • How do you do the button (sumbit) that, when pressurized, transmitted the results to RESULT (output)? Or, to be able to press the RESULT itself (output) and get the data on the way out.

    If all fields are empty, output = NAN, how do you fix it?

    I also don't understand why you can only multiply whole numbers.

    <input name="c" value="1,5" class="input-form" placeholder="K">
    

    The calculation shall be counted as a unit.

    <form oninput="x.value=parseInt(a.value)*(parseInt(b.value)/100)*parseInt(c.value)">
    

    <input name="a" value="400" class="input-form" placeholder="CPL">

    <input name="b" value="3" class="input-form" placeholder="CV1">

    <input name="c" value="1,5" class="input-form" placeholder="K">

    <output name="x" for="a b c" class="input-form" placeholder="">РЕЗУЛЬТАТ</output>

    </form>



  • The function shall be used to extract the drift value from the line https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/parseFloat

    a logic operation can be used to set zero in case of a failed transformation https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Operators/%D0%9B%D0%BE%D0%B3%D0%B8%D1%87%D0%B5%D1%81%D0%BA%D0%B8%D0%B5_%D0%BE%D0%BF%D0%B5%D1%80%D0%B0%D1%82%D0%BE%D1%80%D1%8B

    <form oninput="x.value=(parseFloat(a.value)||0)*((parseFloat(b.value)||0)/100)*(parseFloat(c.value)||0)">
    

    <input name="a" value="400" class="input-form" placeholder="CPL">

    <input name="b" value="3" class="input-form" placeholder="CV1">

    <input name="c" value="1.5" class="input-form" placeholder="K">

    <output name="x" for="a b c" class="input-form" placeholder="">РЕЗУЛЬТАТ</output>

    </form>

    Pay attention to: The split is the point, not the comma.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2