davidcholley
10-24-2003, 07:33 PM
I'm trying to write a function in JavaScript that will automatically increment the value on a form field. The problem that I am having is that the code is concatenating instead of performing a summation. Any help?
noOfCars = document.getElementById('noOfCars').value
if(noOfCars < maxNoOfPax){
document.getElementById('noOfCars').value = noOfCars + 1
}
So, I suppose that the first question is - what is the best way of working with a numeric value obtained from a form?
David H
noOfCars = document.getElementById('noOfCars').value
if(noOfCars < maxNoOfPax){
document.getElementById('noOfCars').value = noOfCars + 1
}
So, I suppose that the first question is - what is the best way of working with a numeric value obtained from a form?
David H