Simora
09-04-2009, 08:48 AM
I am trying to add ( SUM) a input value to a random number.
I want to display the SUM of these 2 values only after the input field is filled out, along with an instruction note that ask them to enter something in another input field.
Here's where I cant seem to get a sum.
[CODE]
var total = document.Addition.randomnumber.value + document.Addition.userInput.value;
document.getElementById('myDiv').innerHTML = total;
[CODE]
Your total is: <span id='myDiv'>
How can I get 'myDiv' to show the total. Its Concatenating rather than summing.
Code samples welcome.
Thanks
I want to display the SUM of these 2 values only after the input field is filled out, along with an instruction note that ask them to enter something in another input field.
Here's where I cant seem to get a sum.
[CODE]
var total = document.Addition.randomnumber.value + document.Addition.userInput.value;
document.getElementById('myDiv').innerHTML = total;
[CODE]
Your total is: <span id='myDiv'>
How can I get 'myDiv' to show the total. Its Concatenating rather than summing.
Code samples welcome.
Thanks