Hi all again,
Firstly thanks to Philip M for getting me this far but i still have a few quirks that i'd like to get around.
Its a price generator with 3 options. User selects an option from a drop down, inputs "number of words" and hey-presto the price appears.
That works superbly well but what would be really cool is if after someone gets a price they then would like to select a different option in order to see a new price. At the moment it means selecting another option and re-entering the number of words and then clicking in the price box to get the new result.
Is there anyway to make that price change automatically (as if by magic even) if either the "option" or "number of words" is changed
I have a sneaky suspicion that Philip M will come to the rescue again but should anyone else have a view that would be great also.
Thanks as always in advance, Phil
Code:
<head>
<!--quote generator -->
<script type="text/javascript">
function update(){
var price = document.getElementById("Package").value;
var words = document.getElementById("words").value;
var wordsOver2000 = words-2000;
if (wordsOver2000 <0) {wordsOver2000 = 0}
words = words - wordsOver2000;
var Tprice = ((price * words) + (price * .80 * wordsOver2000)).toFixed(2) ;document.getElementById("Totprice").value = Tprice;
document.getElementById("Totprice2").innerHTML = "Your Quote Total Is: MYR" + Tprice
}
</script>
<!--end quote generator -->
</head>
Code:
<body>
<!--quote generator -->
<div align="center" class="generator">
PACKAGE - <select name="Package" id = "Package">
<option value="0.027">Economy</option>
<option value="0.038">Standard</option>
<option value="0.049">Express</option>
</select>
No. of Words -
<input type="text" id="words" onchange="update()" value="" />
---> MYR
<input type = "text" id = "Totprice" value="...then click here" /><br />
<br /><strong>(NB - To see a quote for a different package, please select package and re-enter the number of words)</strong>
</div>
<!--end quote generator -->
</body>