Да ради бога мне жалко
Вот яваскрипт код
html можите сами посмотреть в браузере
я б Вам помог, но извените очень занят
Код:
<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function($) {
/* $('.calculator input:text').keydown(function(e)
{
var key = e.charCode || e.keyCode || 0;
// allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
return (
key == 8 ||
key == 9 ||
key == 46 ||
key == 110 ||
key == 116 ||
(key >= 37 && key <= 40) ||
(key >= 48 && key <= 57) ||
(key >= 96 && key <= 105));
});*/
$('.calculator input:text').focus(function(){
if($(this).val() == 0){
$(this).val('');
}
});
$('#onem,#average_depth').keyup(function(eventObject){
var str_onem = $('#onem').val().replace(/,/, '.');
var onem = parseFloat(str_onem);
var str_average_dept = $('#average_depth').val().replace(/,/, '.');
var average_depth = parseFloat( str_average_dept );
console.log(onem+ ' '+average_depth);
var total1 = onem*average_depth;
if(!isNaN(total1)){
$('#total1').text(total1.toFixed(2));
$('#profit').text(' '+total1.toFixed(2));
}
});
$('#plastic_pipe,#price_plastic_pipe').keyup(function(eventObject){
var plastic_pipe = parseFloat($('#plastic_pipe').val().replace(/,/, '.'));
var price_plastic_pipe = parseFloat($('#price_plastic_pipe').val().replace(/,/, '.'));
var total_price_plastic_pipe = plastic_pipe*price_plastic_pipe;
if(!isNaN(total_price_plastic_pipe)){
$('#total_price_plastic_pipe').text(total_price_plastic_pipe.toFixed(2));
}
});
$('#filter,#price_filter').keyup(function(eventObject){
var filter = parseFloat($('#filter').val().replace(/,/, '.'));
var price_filter = parseFloat($('#price_filter').val().replace(/,/, '.'));
var total_price_filter = filter*price_filter;
if(!isNaN(total_price_filter)){
$('#total_price_filter').text(total_price_filter.toFixed(2));
}
});
$('#breakstone,#price_breakstone').keyup(function(eventObject){
var breakstone = parseFloat($('#breakstone').val().replace(/,/, '.'));
var price_breakstone = parseFloat($('#price_breakstone').val().replace(/,/, '.'));
var total_price_breakstone = breakstone*price_breakstone;
if(!isNaN(total_price_breakstone)){
$('#total_price_breakstone').text(total_price_breakstone.toFixed(2));
}
});
$('#pol,#price_pol').keyup(function(eventObject){
var pol = parseFloat($('#pol').val().replace(/,/, '.'));
var price_pol = parseFloat($('#price_pol').val().replace(/,/, '.'));
var total_price_pol = pol*price_pol;
if(!isNaN(total_price_pol)){
$('#total_price_pol').text(total_price_pol.toFixed(2));
}
});
$('#salary,#price_salary').keyup(function(eventObject){
var salary = parseFloat($('#salary').val().replace(/,/, '.'));
var price_salary = parseFloat($('#price_salary').val().replace(/,/, '.'));
var total_price_salary = salary*price_salary;
if(!isNaN(total_price_salary)){
$('#total_price_salary').text(total_price_salary.toFixed(2));
}
});
$('#car,#price_car').keyup(function(eventObject){
var car = parseFloat($('#car').val().replace(/,/, '.'));
var price_car = parseFloat($('#price_car').val().replace(/,/, '.'));
var total_price_car = car*price_car;
if(!isNaN(total_price_car)){
$('#total_price_car').text(total_price_car.toFixed(2));
}
});
$('#plastic_pipe,#price_plastic_pipe,#filter,#price_filter,#plastic_pipe,#price_breakstone,#pol,#price_pol,#salary,#price_salary,#car,#price_car').keyup(function(eventObject){
var total_price_plastic_pipe = (!isNaN(parseFloat($('#total_price_plastic_pipe').text())))? parseFloat($('#total_price_plastic_pipe').text()) : 0;
var total_price_filter = (!isNaN(parseFloat($('#total_price_filter').text())))? parseFloat($('#total_price_filter').text()) : 0;
var total_price_breakstone = (!isNaN(parseFloat($('#total_price_breakstone').text())))? parseFloat($('#total_price_breakstone').text()) : 0;
var total_price_pol = (!isNaN(parseFloat($('#total_price_pol').text())))? parseFloat($('#total_price_pol').text()) : 0;
var total_price_salary = (!isNaN(parseFloat($('#total_price_salary').text())))? parseFloat($('#total_price_salary').text()) : 0;
var total_price_car = (!isNaN(parseFloat($('#total_price_car').text())))? parseFloat($('#total_price_car').text()) : 0;
//console.log(total_price_plastic_pipe+' '+total_price_filter+' '+total_price_breakstone+' '+total_price_pol+' '+total_price_salary+' '+total_price_car);
var cost =
total_price_plastic_pipe+
total_price_filter+
total_price_breakstone+
total_price_pol+
total_price_salary+
total_price_car;
$('#total2').text(cost.toFixed(2));
$('#cost').text(cost.toFixed(2));
var profit = (!isNaN(parseFloat($('#profit').text())))? parseFloat($('#profit').text()) : 0;
var total_profit = profit-cost ;
$('#calculation').text(profit.toFixed(2)+' - '+cost.toFixed(2)+' = '+ total_profit.toFixed(2));
$('#total_profit').text(total_profit.toFixed(2));
});
});
</script>
html можите сами посмотреть в браузере
я б Вам помог, но извените очень занят