There are 4 fields and a button as a result. There is a function that calculates the result of entering each of the fields. How to organize output to display the result:
function Go() { var x1 = parseInt(document.forml.acht_mes.value); var x2 = parseInt(document.forml.kol_mes.value); var x3 = parseInt(document.forml.acht_den.value); var x4 = parseInt(document.forml.kol_den.value); var result=((x1*x2)+(x3*x4))/(x2+x4); } The onClick event should output the result of the function in the fifth field, as output:
<form name="form1"> <input type="text" name="user" placeholder="Введите первое число" required="required" class="input-txt" name="acht_mes" id="acht_mes" /> <input type="text" name="user" placeholder="Введите второе число" required="required" class="input-txt" name="kol_mes" id="kol_mes" /> <input type="text" name="user" placeholder="Введите третье число" required="required" class="input-txt" name="acht_den" id="acht_den"/> <input type="text" name="user" placeholder="Введите четвертое" required="required" class="input-txt" name="kol_den" id="kol_den" /> <button type="submit" class="btn btn--right" onClick="Go();">Посчитать </button> </form>
type="submit"totype="button", the second is to remove unnecessarynameattributes, the third is to pay attention to the fact that even though the characters"1"and"l"are similar,document.formldoes not exist. - Igor