Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MUSAU & KALONJI INTERNATIONAL</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href="rule.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
/* <![CDATA[ */
var masterCost = 0;
var cardiologyCost = 0;
var lightCost = 0;
//<!-- the 3 first functions are working very well and i can get the output on the forms, but i dont know what is wrong with the 2 last functions. to calculate the VAT and the TOTAL VAT incl.--!>
function calcMasterCost(obj) {
masterCost = number(obj) * 300;
calcTotalEstimate();
}
function calcCardiologyCost(obj) {
cardiologyCost = number(obj) * 500;
calcTotalEstimate();
}
function calcLightCost(obj) {
lightCost = number(obj) * 600;
calcTotalEstimate();
}
function number(obj) {
v=obj.value.replace(/\D/i,'');
v=v||0;
obj.value=v;
return v;
}
function calcTotalEstimate() {
var total = masterCost+cardiologyCost+lightCost;
document.forms[0].total.value = "$" + total.toLocaleString();
calcVatEstimate(total);
}
function calcVatEstimate(total) {
vat1 = total / (114*100);
document.forms[0].vat.value ="$" + vat1.toLocaleString();
calcFinalTotal(total+vat1)
}
function calcFinalTotal(v) {
v=Math.round(v*100)/100
document.forms[0].total2.value = "$" + v;
}
</script>
</head>
<body >
<div id="wrapper" >
<div id="header"> <img src="medical.jpg" alt="logo" style="float:left;margin-left: 10px; border-radius: 1em" width=100 height=100 /><h1>MEDICAL QUALITY SUPPLIER</h1></div>
<div id="nav"><h2 style="font-family: arial;text-align: center"> Navigation <h2>
<ul id="navlist" >
<li><a href="index.html"> Home </a></li>
<li><a href="product1.html"> Products </a></li>
<li><a href="orderForm1.html"> Order Here </a></li>
<li><a href="contact1.html"> Contact </a></li>
</ul>
</div>
<div id="article">
<p class="par"> Please provide the number of items you would like to purchase in the rubrics below, thank you</p>
<form>
<fieldset>
<legend> Make orders here please</legend>
<p><label class="order" for="master classic"> How many Littman Master Classic ii do you want? </label>
<input type="text" name="number" id="master classic" size="7" maxlength="7" onblur="calcMasterCost(this);"/>( R300/each) </p>
<p><label class="order" for="cardiology"> How many Littmann Cardiology III do you want? </label>
<input type="text" name="item" id="cardiology" size="7" maxlength="7" onblur="calcCardiologyCost(this);"/>( R500/each) </p>
<p><label class="order" for="lightweight"> How many Littmann LightWeight do you want? </label>
<input type="text" name="bintu" id="lightweight" size="7" maxlength="7" onblur="calcLightCost(this);" />( R600/each) </p>
<p><label class="order" for="total"> TOTAL VAT Exclu </label>
<input type="text" name="total" id="total" size="7" maxlength="7" onfocus="this.blur()" /> </p>
<p><label class="order" for="vat"> VAT </label>
<input type="text" name="vat" id="vat" size="7" maxlength="7" /></p>
<p><label class="order" for="total2"> Total VAT Inclu </label>
<input type="text" name="total2" id="total2" size="7" maxlength="7" /></p>
</fieldset>
<fieldset >
<legend> Enter your contact details below please </legend>
<p><label class="field" for="client name"> Client Name: </label>
<input type="text" name="client" id="client name" size=" 10" maxlength=" 10" /> </p>
<p><label class="field" for="client Email"> Client Email: </label>
<input type="text" name="client" id="client email" size=" 30" maxlength=" 30" /> </p>
<p><label class="field" for="client phone"> Client Phone: </label>
<input type="text" name="client" id="client Phone" size=" 30" maxlength=" 30" /> </p>
<p><label class="field" for="client address"> Client Address: </label>
<input type="text" name="client" id="client address" size=" 30" maxlength=" 30" /> </p>
<p>where is the address you provided?</p>
<label class="field" for="client house"> Your House
<input type="radio" name="client" value="house" id="client house" size=" 10" maxlength=" 10" /></label>
<label class="field" for="client office"> Your office
<input type="radio" name="client" value="office" id="client office" size=" 10" maxlength=" 10" /></label>
<label class="field" for="university"> Your University
<input type="radio" name="client" value="university" id="university" size=" 6" maxlength=" 6" /></label>
</fieldset>
<p><input type="submit" value="Submit the Form" />
<input type="reset" value="Clear the Form" /> </p>
</form>
</div>
<div id="sidebar">
<h3 style="text-align: center" >LITTMAN STETHOSCOPES</h3> <br /> <hr />
<img src="medical.jpg" alt="stethoscope" width=100 height= 100 style="margin-left:35px ;border-radius:2em " />
</div>
<div id="footer">jjjjjjjjjjjjjjjjjjjj
</div>
</body>
</html>
Bookmarks