

<script>
    function passValues(){
       var state = document.getElementById("states").value;
     
     
       var price = parseFloat(document.getElementById("price").value);
       var perc;    
       if (state == 'CA') {
           perc = .06;
       }
       else if (state == 'CO') {
           perc = .08;
       }
        else {
           perc = .07;
        }
        total = price + (price * perc);
        document.getElementById("showprice").innerHTML = 'your total is ' + total.toFixed(2) + ' and your sales tax is ' + perc;

       /* If the user selects CA, add 6% sales tax.
If colorado, add 8%.
All else add 7%*/
        
        
    }
    
var states =  [ 'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FM', 'FL', 'GA', 'GU', 'HI', 'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MH', 'MD', 'MA', 'MI', 'MN', 'MS', 'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'MP', 'OH', 'OK', 'OR', 'PW', 'PA', 'PR', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VI', 'VA', 'WA', 'WV', 'WI', 'WY' ];
var dropdown = '<select id="states" onchange="passValues();"><option value="">Choose Below</option>';
    
    for (var i=0;i<states.length;i++){
        dropdown += '<option value="' + states[i] + '">' + states[i] + '</option>';
    }    
    dropdown += '</select>';
    document.write(dropdown);
</script>
<input type="hidden" id="price" value="19.99">

 <span id="showprice"></span>




we'll need an event like onchange
we need a function take the price and add the % tax based on the selection
it outputs the price


