I have a script, where I am trying to access a variable and then have a text field, where I am able to input numbers and then when the "submit" button is clicked, I want the "input" to be added to the variable, the only problem is my code for displaying the variable won't work.
my code(html):
<form id="form" onsubmit="return false;">
<input style="width:100px;" type="text" id="Input" />
<input style="width: 100px;" type="submit" id="submitBut" onclick="getInput();" />
</form>
<a href="#">current amount is: <span id="amountSoFar"></span></a>
my code(javascript):
var amountSoFar : int = 1;
function getInput() {
var input = document.getElementById("Input").value;
amountSoFar = amountSoFar + input;
alert(input);
}
my code(css):
#Input{
position: absolute;
top: 100px;
margin-left: -100px;
left: 50%;
}
#submitBut{
position: absolute;
top: 120px;
margin-left: -100px;
left: 50%;
}