Hi everyone!

I am rather stuck trying to create a very simple savings calculator on a website. All I need to have is a field for number of PC's, Printers, Servers and how much is spent per month on IT.

When they click the "get Quote" button, I'm hoping to show them how much I can save them!! This is what I have so far, if anyone can help, that would be so great!

<script type="text/javascript">
function MyCalc(){
var val1 = document.frmqut.textPc.value;
var amt1 = 190 * parseFloat(val1);
var val2 = document.frmqut.textPrinter.value;
var amt2 = 50 * parseFloat(val2);
var val3 = document.frmqut.textServers.value;
var amt3 = 900 * parseFloat(val3);
var val4 = document.frmqut.textCost.value;
var amt4 = parseFloat(val4);

var amt = amt4 - (amt1 + amt2 + amt3);
alert("Your monthly total to support these PC's will be £" + amt);
}
</script>
<font color="#666666">Please Enter Number of PC's</font><br>
<input type="text" name="textPc">
<br>
<font color="#666666">Please Enter Number of Printers</font><br>
<input type="text" name="textPrinter">
<br>
<font color="#666666">Please Enter Number of Servers</font><br>
<input type="text" name="textServers">
<br>
<font color="#666666">Please Enter Monthly IT Cost</font><br>
<input type="text" name="textCost">
<br>
<input type="button" name="btnCalc" value="Get the Quote" onclick="MyCalc()">
</p>

Someone kindly helped me by sending me this very basic script.

TIA
Hi2Shy

You just need a <form>

<script type="text/javascript">
function MyCalc(){
var val1 = document.frmqut.textPc.value;
var amt1 = 190 * parseFloat(val1);
var val2 = document.frmqut.textPrinter.value;
var amt2 = 50 * parseFloat(val2);
var val3 = document.frmqut.textServers.value;
var amt3 = 900 * parseFloat(val3);
var val4 = document.frmqut.textCost.value;
var amt4 = parseFloat(val4);

var amt = amt4 - (amt1 + amt2 + amt3);
alert("Your monthly total to support these PC's will be £" + amt);
}
</script>
<form name="frmqut" id="frmqut">
<font color="#666666">Please Enter Number of PC's</font><br>
<input type="text" name="textPc" >
<br>
<font color="#666666">Please Enter Number of Printers</font><br>
<input type="text" name="textPrinter">
<br>
<font color="#666666">Please Enter Number of Servers</font><br>
<input type="text" name="textServers">
<br>
<font color="#666666">Please Enter Monthly IT Cost</font><br>
<input type="text" name="textCost">
<br>
<input type="button" name="btnCalc" value="Get the Quote" onclick="MyCalc()">
</p></form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.