There are many ways to do this, as with most javascript projects. Here's what I would do (I will sketch out the process):
Code:
var taxRate = .086 (or whatever the tax rate is);
var products = new Array();
// products will be a set of arrays; each array will contain the product and its price with tax
products[0] = ["Epson Stylus C88",99.01*(1+taxRate)];
// if Epson is to be taxed, for instance)
products[1] = ["Canon Pixma IP1600",38.05];
// if Canon will not be taxed, for instance
etc...
Then, create your drop down list of products with javascript
:
Code:
document.write('<select name="s1" onChange="which_prt()">');
document.write('<option value="none" selected></option>');
for (var i=0; i<products.length; i++) {
document.write("<option value="\"+products[i][1]+"\">"+products[i][0]+" </option>");
}
document.write('</select>');