Example

plus equals

Without parseFloat, the "+" (in total) treats the numbers entered into the form's fields as strings instead of numbers, so it concatenates them instead of adding them.

With parseFloat, if you attempt to add two sets of letters, or a combination of numbers and letters, they equal zero.

Changing the name of the form causes an error alert, "document.testForm has no properties."

Returning true causes the form to submit, which loads the current page with the value of the fields appended to the url - /example4.html?number1=2&number2=2&number3=4 - as a new document

Lab 1

(+ - * /) equals

Extra Credit 1

I like this solution, even though it's not to the letter of the assignment, because the scripting is built into the form elements (just don't type in any non-numeric characters...).


Here's my other calculator.

Extra Credit 2

The form and script from Chapter 16, slightly modified...

Username:
Password:
Input Events
Filename:
My Computer Peripherals:
28.8K Modem
Tape Backup
Printer
Monitor
Zip Drive
CD Rom
My Web Browser:
Netscape Navigator
Internet Explorer
Opera
Aol
My Hobbies:
My Favorite Color: