Doğru Cevap
-
<input type=text id="fiyat" value="8.00"> TL <select name="adet" id="adet" onChange="Hesapla();"> <option value="5">5 adet</option> <option value="10">10 adet</option> <option value="15">15 adet</option> <option value="20">20 adet</option> </select> <p id="sonuc"></p> <script> var fiyat = document.getElementById("fiyat").value; var sel = document.getElementById("adet"); function Hesapla(){ var sonuc = sel.options[sel.selectedIndex].value * fiyat; document.getElementById("sonuc").innerHTML = sonuc + "TL"; } </script>
eğer çarpılmış fiyatın ilk input'a yazdırılmasını istiyorsani fonksiyondaki son satırı şöyle değiştir;
document.getElementById("fiyat").value = sonuc;
Cevaplar
-
<script>
function Hesapla(){
var fiyat=document.GetelementbyId("fiyat").value;
var sel = document.getElementById("adet");
var adet= sel.options[sel.selectedIndex].value;
document.getElementById("sonuc").InnerText=adet;
}
</script>
<input type=text id="fiyat" value="8.00"> TL
<select name="adet">
<option value="5">5 adet</option>
<option value="10">10 adet</option>
<option value="15">15 adet</option>
<option value="20">20 adet</option>
</select>
<label id="sonuc"></label>-
etkiweb
Arkadaşım İlgilendiğin Çok Teşekkürler.Fakat Çalışmadı. :(12 yıl önce yazılmış -
Supervisor
rica ederim . kontrol edemiyoum bende ezbere yaziyorum
.
select name="adet" id="adet" yapsana12 yıl önce yazılmış -
etkiweb
Olmadı Abicim ya :(12 yıl önce yazılmış -
Supervisor
ya da
$("sonuc").text()= $("select#adet").val()* $("input#fiyat").val()*;12 yıl önce yazılmış -
Supervisor
su an bakamiyorum. ama cevap alamazsan 1 saat sonra cevaplayabilirim12 yıl önce yazılmış -
etkiweb
Çok teşekkürler fakat yine olmadı be hocam :( sağolasın yinede.12 yıl önce yazılmış -
Supervisor
ustte yazdigimi kullanabilmen icin jquery i eklemelsin .
http://code.jquery.com/jquery-1.6.min.js12 yıl önce yazılmış
-