WDV221 Intro Javascript

Project 6 Arrays Assignment


Please complete the following exercises on this page. When complete post this page to your server. Make a link in your WDV221 homework page for this assignment.

Include a comment in each script with the exercise number and a description of what the script is supposed to do.

Using Blackboard submit this Assignment.


Lookup Tax Rate Form

This form will use arrays to load the values into the drop down list. It will allow the user to select a state from the dropdown list. Once it is selected the tax rate for that state will be dislayed on the form.

Please select a state:

The Sales tax rate is:

Instructions:

  1. Create an array called states that lists the following states in this order: Iowa, Illinois, Missouri, Wisconsin
  2. Create a parallel array called stateSalesTax that lists the following values in this order: 6%,11%,7%,8%.
  3. Use Javascript to dynamically load the list of states into the drop down menu.
  4. Create a function called salesTaxLookup( ).
  5. Use the onchange event handler on the select element to run salesTaxLookup( )
  6. The function will use a lookup loop to find where the state is located in the states array. It can then get the corresponding tax rate from the stateSalesTax array.
  7. It will display the tax rate for the selected state.