I´m trying to add a value to totalsum when checking a checkbox.
But I'm a n00b at this and I can't find any relevant information on the Internet to help me with my little problem.
I'm only including the relevant part of the script since it is way way long and the only thing that differs is the different artnr.
The + 60 in the last line is for shipping and handling so it should be left there as is.
The text in bold is what I can't get working...
I'm using JavaScript and so far the script looks like this:
<script language="JavaScript">
function calculate(){
var totalsum = 0;
if(!isNaN(parseInt(document.forms[0].artnr110.value))){
totalsum=totalsum + parseInt(document.forms[0].artnr110.value)*199;
document.forms[0].sum110.value = parseInt(document.forms[0].artnr110.value)*199;
}
if(!isNaN(parseInt(document.forms[0].extra.checked))){
totalsumma=totalsumma + parseInt(document.forms[0].extra.checked)*1;
}
document.forms[0].summa.value = totalsumma + (60) + " :-";
}
</script>
These are some values I have in my form:
<form name="order" action="order.asp" method="POST">
<INPUT TYPE="TEXT" SIZE="2" NAME="artnr110"
id="artnr110" onChange="calculate()">
<INPUT TYPE="TEXT" SIZE="2" NAME="sum110"
id=sum110 readonly>
<INPUT TYPE="TEXT" SIZE="3" NAME="sum"
id=sum width="20">
<INPUT TYPE="checkbox" NAME="extra" VALUE="50"
id=extra onClick="calculate()">
<input type="submit" value="send" name="order" />
</form>
I got everything but that checkbox to work. I tried around with different settings but beeing a n00b has it's limitations... ;)
Thanks in advance for help.
Ray