<script language="Javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script language="Javascript">
$(document).ready(function() {
/* Urun ve adet select boxlarindaki degisimlerde toplam islemi yaptir */
$('select[id*=urun]').change(function() { toplam(); });
$('select[id*=adet]').change(function() { toplam(); });
});
function toplam() {
var toplam = 0;
$('select[id*=urun]').each(function() {
var iterasyon = $(this).attr('rel');
var seciliurun = $(this).attr('value');
var fiyat = $('#fiyat'+seciliurun).attr('value');
var adet = $('#adet'+iterasyon).attr('value');
var aratoplam = fiyat * adet;
$('#toplam'+iterasyon).val(aratoplam);
toplam = toplam + aratoplam;
});
$('#tumtoplam').val(toplam);
}
</script>
<select name="urun1" id="urun1" rel="1">
<option value="1">Ayran - 5 TL</option>
<option value="2">Tost - 10 TL</option>
</select>
<select name="adet1" id="adet1">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<input type="text" name="toplam1" id="toplam1" />
<br /><br />
<select name="urun2" id="urun2" rel="2">
<option value="1">Ayran - 5 TL</option>
<option value="2">Tost - 10 TL</option>
</select>
<select name="adet2" id="adet2">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<input type="text" name="toplam2" id="toplam2" />
<br /><br />
<select name="urun3" id="urun3" rel="3">
<option value="1">Ayran - 5 TL</option>
<option value="2">Tost - 10 TL</option>
</select>
<select name="adet3" id="adet3">
<option>0</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
<input type="text" name="toplam3" id="toplam3" />
<br />
TOPLAM: <input type="text" name="tumtoplam" id="tumtoplam" size="3" />
<!-- urun fiyatlarini tanimla -->
<input type="hidden" id="fiyat1" value="5" />
<input type="hidden" id="fiyat2" value="10" />