İşleme baştan başlayarak halledelim. Elimizde checkbox inputlar var, bir adet text input, bir adet p elementi, bir de sonraki sayfaya fiyatı gönderebilmemiz için sonraki adım butonu.
<script type="text/javascript">
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jay Rumsey | http://www.nova.edu/~rumsey/ */
var lastprice = 1.50;
function UpdateCost() {
var sum = 1.50;
var gn, elem;
for (i=0; i<5; i++) {
gn = 'game'+i;
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}
lastprice = sum.toFixed(2);
document.getElementById('totalcost').value = lastprice;
document.getElementById('toplam').innerHTML= lastprice;
}
function nextStep(){
window.location.href = 'http://www.siten.com/checkout.php?price='+lastprice;
}
</script>
<input type="checkbox" id='game0' value="9.99" onclick="UpdateCost()">Game 1 ( 9.99)<br>
<input type="checkbox" id='game1' value="19.99" onclick="UpdateCost()">Game 2 (19.99)<br>
<input type="checkbox" id='game2' value="27.50" onclick="UpdateCost()">Game 3 (27.50)<br>
<input type="checkbox" id='game3' value="45.65" onclick="UpdateCost()">Game 4 (45.65)<br>
<input type="checkbox" id='game4' value="87.20" onclick="UpdateCost()">Game 5 (87.20)<br>
<input type="text" id="totalcost" value="1.50" >
<p id="toplam">1.50</p>
<p><a onclick="nextStep()">Sonraki Adım</a></p>