Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Sales Tax to a Form

Status
Not open for further replies.

toshga

Technical User
May 29, 2003
8
US
I received this form from Cheech on this forum and it works great. I was wondering how would you add a button that when checked would add an 8.25% sales tax to the total. I want to add this option for customers that live in the same state I am in. Any help would be greatly appreciated.

Regards,
Todd
Texas


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script language="javascript">
function sumup(){
if (document.forms.form1.painting.value == "0"){
paintval=0;
}
if (document.forms.form1.painting.value == "painting1"){
paintval=100;
}
if (document.forms.form1.painting.value == "painting2"){
paintval=400;
}
if (document.forms.form1.painting.value == "painting3"){
paintval=600;
}
quantval = document.forms.form1.quantity.value;
mountval = document.forms.form1.mounting.value;
totalval = (paintval*quantval) + (mountval*quantval);
document.forms.form1.total.value = totalval;
}
</script>
</head>

<body>
<form name="form1" method="post" action="">
<p>
<select name="painting" id="painting" onChange="return sumup();">
<option value="0" selected>** Please select **</option>
<option value="painting1">Painting 1 - &pound;100</option>
<option value="painting2">Painting 2 - &pound;400</option>
<option value="painting3">Painting 3 - &pound;600</option>
</select>
Which Painting<br>
<input name="quantity" type="text" id="quantity" value="0" size="5" onChange="return sumup()">
How many?<br>
<select name="mounting" id="mounting" onChange="return sumup()">
<option value="0">** Pease Select **</option>
<option value="150">Canvas - £150</option>
<option value="250">Stretched - £250</option>
<option value="350">Framed &amp; Stretched - £350</option>
</select>
Mounting Options?
</p>
<p>
<input name="total" type="text" id="total" value="0" size="8" readonly>
Total Cost (Quantity * (Painting choice + Mounting cost)) </p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
 
Total_TaxIncluded= (TotalVal x 8.25)/100

:--------------------------------------------------------------------------:
fugitive.gif

ok,ok...I did shoot the deputy but he told me he was the sheriff!
:--------------------------------------------------------------------------:
 
Where does that go? and.... is there a way to have it as a button (that way when it is checked, the tax is added, but otherwise its not)
 
ops, that would be:
All the best!

:--------------------------------------------------------------------------:
fugitive.gif

ok,ok...I did shoot the deputy but he told me he was the sheriff!
:--------------------------------------------------------------------------:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top