HTML
var ReadOut = document.getElementsByName('ReadOut'); var Currents = 0; var FlagNewNum = false; var PendingOp = ""; // push number function NumPressed(Num) { if (FlagNewNum) { ReadOut.value = Num; FlagNewNum = false; } else { if (ReadOut.value == "0") ReadOut.value = Num; else ReadOut.value += Num; } } <div id="block" style="cursor: move; position: absolute;"> <script src="js/fCalc.js"></script> <form name="calc" action="" id="form" class="colortext" method="POST"> <table class="tblCalc" cellpadding="0 cellspacing=0"> <tr> <td colspan=5 aling="middle"> <input id="editWide" name="ReadOut" type="text" placeholder="enter number" size=40></td> </tr> <tr> <td><input class="number" name="btnSeven" type="Button" value="7" onclick="NumPressed(7)"></td> </tr> </table> </form> </div> This is a piece of a form for a calculator. Why does the number 7 not appear when I click the btnSeven button in the ReadOut field? Debugging in the moss, it shows that the NumPressed function is executed, the seven comes, checks are underway and the idea is ReadOut.value + = Num; should display in ReadOut "7". But this is not happening.
ReadOutis not an element, but a list of elements, useReadOut[0]for example - andreymal