<html>
<head>
<title>Пример обращения к элементам формы</title>
<script>
function plus(){
let form = document.forms.myForma
let a = Number(form.elements.input_a.value)
let b = Number(form.elements.input_b.value)
let s=a+b
// document.write(s)
document.getElementById('answer').innerText="Ответ: " + s
// getElementById - обращение
// alert(s) - к элементу по id
// innerText - изменение текста объекта
document.getElementById("answer").style.color="green"
document.getElementById("telo").style.background="yellow"
}
</script>
</head>
<body bgcolor="pink" id="telo">
<h1>Калькулятор</h1>
<form name="myForma">
Введите А: <input type="text" value="0" name="input_a"></br>
Введите B: <input type="text" value="0" name="input_b"></br>
<input type="button" value="+" onclick="plus()"></br>
</form>
<font color="red">
<p id="answer">Ответ</p>
</font>
</body>
</html>