Hey, some quick questions again. Need to add few values. There has to be a dropdown list with certain values and add the value of them to totalSum
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.vahe { margin-top: -1px;
margin-bottom: -2px;
}
.vahe2 { margin-top: -17px;
margin-bottom: 15px;
}
</style>
</head>
<body>
<table class="puuks" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr class="puuks">
<td class="puuks" valign="top" width="350">
<form action="contact.php" method="post" >
<form name="calc" id="calc" onSubmit="return false;">
<strong>Valitse Kylpytynnyri</strong>
<br>
<select name="num" id="num" onChange="calcForm(this.form);">
<option value="1">Kylpytynnyri Ø 160 cm - 849.00 €</option>
<option value="2">Kylpytynnyri Ø 180 cm - 909.00 €</option>
<option value="3">Kylpytynnyri Ø 200 cm - 959.00 €</option>
<option value="4">Kylpytynnyri Ø 220 cm - 1’029.00 €</option>
<option value="5">Kylpytynnyri Ø 240 cm - 1’129.00 €</option>
</select>
</form>
<br>
<br>
<strong>Valitse oikea kamina:</strong><br>
<input name="part1" type="radio" onClick="DisplayPrice();" value="0,uppokamina27" checked="CHECKED">
Uppokamina (27kw) - 0 €- vakio<br>
<input type="radio" value="249,ulkokamina27" name="part1" onClick="DisplayPrice();">Ulkokamina (27kw) - 249.00 €<br>
<input type="radio" value="279,uppokamina40" name="part1" onClick="DisplayPrice();">Uppokamina (40kw) - 279.00 €<br>
<input type="radio" value="395,ulkokamina40" name="part1" onClick="DisplayPrice();">Ulkokamina (40kw) - 395.00 €<br>
</td>
<td class="puuks" valign="top" width="350">
<strong>Kylpytynnyrin lisävarusteet:</strong><br>
<input type="checkbox" name="cbox[]" value="350,linex," id="part2" onClick="DisplayPrice();">Line – X (suosittelemme) - 350.00 €<br>
<input type="checkbox" name="cbox[]" value="49,kansi," id="part3" onClick="DisplayPrice();">Kansi mänty (suosittelemme) – 49.00 €<br>
<input type="checkbox" name="cbox[]" value="45,suojapressu," id="part4" onClick="DisplayPrice();">Suojapressu - 45.00 €<br>
<input type="checkbox" name="cbox[]" value="40,poltettu," id="part5" onClick="DisplayPrice();">Poltettu mänty – 40.00 €<br>
<input type="checkbox" name="cbox[]" value="250,lampokasitelty," id="part6" onClick="DisplayPrice();">Lämpökäsitelty mänty - 250.00 €<br>
<input type="checkbox" name="cbox[]" value="50,valmiiksi," id="part7" checked onClick="return false" readonly>Valmiiksi koottuna – 50.00 €<br>
<input type="checkbox" name="cbox[]" value="300,porejarjestelma," id="part8" onClick="DisplayPrice();">Porejärjestelma – 300.00 €<br>
<input type="checkbox" name="cbox[]" value="300,led," id="part9" onClick="DisplayPrice();">LED valot - 300.00 €<br>
</td>
<td class="puuks" float="right" valign="top">
<h2>Summa</h2>
<input class="vahe2" name="summa" type="text" id="totalSum" value="" size="25" readonly border="0">
<p class="vahe">Etu- ja sukunimi</p>
<input name="name" type="text" value="" size="25">
<p class="vahe">Sähköposti</p> <input name="email" type="text" size="25">
<p class="vahe">Puhelin</p> <input name="puhelin" type="text" size="25">
<p class="vahe">Osoite</p> <input name="osoite" type="text" size="25">
<p class="vahe">Lisätietoja</p><textarea name="message" rows="3" cols="21"></textarea><br />
<input type="submit" value="Tilaa kylpytynnyri">
</form>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/sh...d.php?t=235581
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above
return str;
}
function calcForm(form,submit_it) {
// By making the first element 0, this associates the list precisely with the select list.
// To maintain all you need to do is change this array.
var prices = new Array('0.00', '849.00','909.00','959.00','1029.00','1129.00');
var sel = document.getElementById('num'); // The list
var ind = sel.selectedIndex; // What's selected
var total = document.getElementById('totalSum');
total.value = prices[sel[ind].value]; // the correlating value from the array
}
function DisplayPrice(){
var sum = 0;
var tarr = getRBtnName('part1').split(',');
sum += Number(tarr[0]); // .split(',');
var emailInfo = tarr[1];
for (var i=2; i<10; i++) {
var el = document.getElementById('part'+i);
if (el.checked) {
tarr = el.value.split(',');
sum += Number(tarr[0]);
emailInfo += ','+tarr[1]; // saved for email purposes
}
}
document.getElementById('totalSum').value=sum.toFixed(2)+" €";
}
DisplayPrice();
</script>
</body>
</html>
The dropdown list prices are displayed in the totalSum box, but it doesn't include other selected prices there
Example of the page http://martinlougas.eu/hinnat.html