Jump to content
php.lv forumi

Calculate


haardys

Recommended Posts

Nepieciešama tāda fīča - input laukā ievada skaitli, konkrēti preces cenu, un tur pat blakus uzreiz izrēķina preces cenu ar PVN. Man tas viss izdodas tikai ar sumbit palīdzību, bet būtu idāli, ja jau uzreiz tiktu izrēķināts, lai nebūtu jāspiež submit!

Link to comment
Share on other sites

tad javascript:

HTML:

<input type="text" name="price" id="price" value=""  onchange="calculate_wat();" />
<input type="text" name="price_full" id="price_full" value="" />

JS:

document.onload(calculate_wat());
function calculate_wat() {
var price=document.getElementById('price').value;
var wat=22;
document.getElementById('price_full').value=price+price*wat/100;
}

Edited by Blitz
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...