I found [this][1], rather difficult, javascript example online and I've implemented it with success in my website.
However, I would like to get the result of, in this case, the two subtotals in one new text-field.
The traditional getElementbyId and total.value=total didn't work out.
EDIT
function doMath()
{
// Capture the entered values of two input boxes
var twogiga = document.getElementById('twogig').value;
var fourgiga = document.getElementById('fourgig').value;
// Add them together and display
var sum = parseInt(twogiga) + parseInt(fourgiga);
document.getElementById('total').value = parseInt(sum);
}
This is the javascript I use. But for some reason, when I have just one value (twogig), the total is set as NaN. What is wrong with my script?
thisin your first line.parseInton all of the numbers you're going to be adding together you don't need to use it again on the sum.