js打折 (批量计算9折 8折 7折

js打折 (批量计算9折 8折 7折_第1张图片



活动价格<select onchange='saleall()' id='allsale' name='act_select'><option value='1'>全价</option><option value='0.9'>九折</option><option value='0.8'>八折</option><option value='0.7'>七折</option></select>

			//打折开始
					function saleall(){
					
					var zzz=$('#allsale').val();
                           
					  
					 $('.act_table').find('tr').each(function(){
						                         
                     $(this).find('td input').each(function(){
                        
					 var n_price=$(this).attr('value')*zzz;
					 
					 var num=new Number(n_price);
					
                     var n_price=num.toFixed(2);
                   
					 $(this).val(n_price);
					//$(this).val($(this).attr('value')*zzz);
					 
					 
                  });
				  
				  });
					
					}
					
					
					function onsale(id,price){
						
						var act_price=$('#act_price_'+id).val();	
					    var act_sale=$('#onsale_'+id).val();
						var sale_price=act_price*act_sale;
						$('#act_price_'+id).val(sale_price);							
					 
					
					}
					
					//打折结束


你可能感兴趣的:(js打折 (批量计算9折 8折 7折)