动态改变形式值

I would like to change the value of input fields in a form based on the input of one of the fields live without refresh before submitting the form.

For example

<input type="text" name="chance" value="50">

Let's say a user inputs 80 into the field.

Would I then be able to do the calculation 1/input x 98 where the input = 80 (so it would be 1/80 x 98).

I would then set this as the value of input of another field in the form.

<input type="text" name="payout" value="1/input x 98">

Without refreshing the page. TIA

On change of chance you can set the value of payout like this.

<input type="text" name="chance" value="50"
onchange="document.getElementById('payout').value='1/'+this.value+'x 98'">

If you want on that on the go without need of enter then use

<input type="text" name="chance" value="50"
    onkeyup="document.getElementById('payout').value='1/'+this.value+'x 98'">

Chance: <input type="text" name="chance" value=""
   onkeyup="document.querySelector('input[name=payout]').value=this.value?1/this.value*98:''">

<br/><br/>Payout: <input type="text" name="payout" value=""><br/>

If you want to restrict the chance field to enter only number then check out this link

</div>