Remember that form elements of type "text" are text and not numbers. Even if you type a "5" in a text box, the Javascript interprets the value as a text character "5" and not the integer 5. In order to help the Javascript think of the text box entry as a number, use the eval function. A form called "numbers" and an example of the eval function is given below. Notice that text plus text is just text written side by side
or concatenated into one string of text. The sum of two number created by
the eval function results in the numerical sum -7 + 12 which is 5.
|