Hi I wanted to know how I could store a javascript calculation into a form instead of it being an alert or just written out in another page? Below is my Javascript code, which calculates price.
<script type="text/javascript">
function getQuote() {
var qtyvar = document.getElementById("qty").value;
var qlyvar= document.getElementById("qly").value;
var quote;
if (qlyvar=="basic") {
quote=10*qtyvar;
}
else if (qlyvar=="medium") {
quote=15*qtyvar;
}
else if (qlyvar=="high") {
quote=20*qtyvar;
}
alert('£' + quote);
}
This script is run when this button is pressed
<p><input class="mybutton" name="Quote" value="Calculate quote" onclick="getQuote();"></p>
How can I store the result of the Javascript into the button or inside the form? Hopefully I explained this clearly