You test the value of the drop down field and then execute the desired block of code. The value of the drop down box will be limited to the entries in the drop down list unless you allow users to add new items.
That one line should be:
for (var i=1; i<=17; i++)
Since the variable I is not the same as the variable i.
Thanks for all your help.
What you need to do is determine what the value of the dropdown is when you don't consider it to be filled-in. People will often include a list item that is simply a single space so it appears blank, or something like "Please select". If you have something like this, your script would check for it and perform the calculation accordingly.