I am using javascript to display a dropdown menu on an html page. This menu lists 48 states and is used to calculate shipping costs to each state. I have an onChange() event in the <select> tag that sends the selected state to another function to figure up the shipping cost. The page is refreshed with 'location.href=location.href'. When the page is refreshed the shipping amount is displayed in the page. Everything works fine except for one thing.
When the page refreshes the State the user selected is not displayed in the dropdown box. It defaults back to the first option in the list.
It would be easy to fix this if the dropdown menu was submitted in a form but it is actually in the script itself. What would be an easy way to show the selected state in the box when the page is refreshed?
I have tried using a cookie but couldn't figure out how to make the selected state the active option. I am not too good with cookies so maybe I did something wrong.
How would I go about setting a cookie for a <select> and set the selected option 'Active' when the page reloads??
Thanks