Hi im trying to teach myself js but im haveing trouble with getting the number to push from user input form to the array any suggestion would be much appreciated thanks
<html>
<body>
<form>
<input id="input" type=text>
<input type=button onclick="myFunction()" value="Add Number"/>
</form>
<script>
var number=["1"]
function myFunction()
{
var x=document.getElementById("box");
number.push=document.getElementById("input").value
x.innerHTML=number.join('<br/>');
}
</script>
<div id="box"; style="border:1px solid black;width:150px;height:150px;overflow:auto">
</div>
</body>
</html>


Reply With Quote

Bookmarks