|
Hi:
I am writing a script for school and the script involves 3 dropdown lists of products. If a certain product is selected say a canon printer then there would be no tax on this item but tax on the rest. What would be the best way to do this?
Here is some code:
HTML
<tr>
<td colspan=4>
<h3>Printers</h3>
</td>
</tr>
<tr>
<td>
<select name="s1" onChange="which_prt()">
<option value="none" selected></option>
<option value="99.01">Epson Stylus C88 </option>
<option value="38.05">Canon Pixma IP1600</option>
<option value="957.11">EPSON STYLUS PHOTO 2200</option>
</select>
</td>
<td>
<input type="text" name="prt_qty" onChange="totalup_prt()"/>
</td>
<td>
<input type="text" name="prt_price" disabled/>
</td>
<td>
<input type="text" name="prt_total" disabled/>
</td>
</tr>
Javascript
function which_prt()
{
for (i=0;i<document.form1.s1.length;i++)
{
if(document.form1.s1.selected==true)
{
if (document.form1.s1.value=="none")
{
document.form1.prt_qty.value=""
document.form1.prt_price.value=""
document.form1.prt_total.value=""
tmp_prt_qty=0
tmp_prt_price=0
tmp_total_ord=(parseFloat(tmp_total_ord.toFixed(2))-parseFloat(tmp_prt_total.toFixed(2)))
tmp_prt_total=0
total_invoice()
}
else
{
document.form1.prt_qty.value=""
document.form1.prt_price.value=""
document.form1.prt_total.value=""
document.form1.prt_qty.disabled=false
tmp_prt_price=document.form1.s1.value;
document.form1.prt_price.value=("$"+tmp_prt_price)
}
}
}
}
function totalup_prt()
{
document.form1.prt_qty.disabled=true
tmp_prt_qty=document.form1.prt_qty.value
tmp_prt_total=(tmp_prt_price*tmp_prt_qty)
document.form1.prt_total.value=("$"+tmp_prt_total.toFixed(2))
document.form1.prt_total.value=document.form1.prt_total.value
total_invoice()
}
|
|
|
|
|
|
|
|