Javascript Calculator problem
-
Hi there.
Im running a very simple script that allows visitors to the site to input the size of their garden and get a quote.
It used to work on the old wordpress website, but now its not.
Its in swedish, but the code is shown below, and is live here:
https://www.goodlawns.se/price-calculator/
where it says: Storlek p? gr?smattan, thats where you put your number and press Calc.
Im not a coder, expecially in JS, this was done by a friend a while ago. so be gentle with me?
It works when i put it into notepad++ and open it in firefox etc, so im thinking its a wordpress issue?
this is the code
<script language=”javascript” type=”text/javascript”>
function calcquote(){
a=Number(document.calculator.area.value);
var scaleprice = 2.85;
var base = 2.85;
if (a > 1200)
{
scaleprice = 1.65;
}
var base2 = scaleprice * a;
var scarify2 = 3 * base2;
var aerate2 = 2 * base2;
document.calculator.total.value=base2;
document.calculator.total2.value=scarify2;
document.calculator.total3.value=aerate2;
}
</script>
</head>
<body>
<!– Opening a HTML Form. –>
<form name=”calculator”>
<!– Here user will enter 1st number. –>
Storlek p? gr?smattan: <input type=”text” name=”area”>
<!– Here result will be displayed. –>
Grundbehandling: <input type=”text” name=”total”>
Vertikalsk?rning pris: <input type=”text” name=”total2″>
Pipluftning pris: <input type=”text” name=”total3″>
<input type=”button” value=”Calc Quote” onclick=”javascript:calcquote();”>
</form>
</body>
- The topic ‘Javascript Calculator problem’ is closed to new replies.