If you are not a U.S. resident, you won't have to pay, but you should study this example anyway!
The beginning of the program defines "constructor functions" for two data types we'll use in the tax calculation. These new datatypes are TaxBracket and TaxSchedule. The next portion of the program creates and initializes an array of four TaxSchedule objects, each of which contains five TaxBracket objects. This is the data that the program will use to compute income tax.
Next comes the definition of a function named compute(). This is the function that computes the estimated tax you'll have to pay. It doesn't just perform the computation, however. It also reads the user's input from the form, and stores the result of the tax computation, along with intermediate results in the computation back into the form. The variable f in this function refers to the HTML form, and the various elements of the form are accessed by name. Thus, you'll see expressions like f.income.value to refer to the string that the user entered in the income field. The names for these fields will be assigned when the form is itself defined. Note that this compute() function both reads and writes the value of expressions like f.income.value and f.standard.checked--querying and setting the values displayed in the form. If you follow the comments, and refer occasionally to the reference section (Part III of this book), you may be able to follow the logic behind the tax computation.