作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何应用税收、小计折扣以及计算总计?
我的这些段落具有以下 ID
<p id="subtotal">15000</p>
<p id="tax">10</p> // In percentage
<p id="discount">1000</p>
<p id="grandtotal"></p> // Grandtotal will be calculated and displayed here using jquery
总金额为 15000 +(1500//税)-(1000//折扣)= 15500
如何使用 jQuery 计算此值?
最佳答案
var subtotal = parseFloat( $('#subtotal').text());
var taxRate = parseFloat( $('#tax').text());
var disc = parseFloat( $('#discount').text());
var taxAmount = subtotal * (taxRate/parseFloat("100")); //15000 * .1
var yourGrandTotal = subtotal + (taxAmount) - (disc);
//update div with the val
$('#grandtotal').text(yourGrandTotal);
关于javascript - 如何使用 jQuery 对发票应用税收、折扣,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3506863/
需要一个良好且灵活的数据库模式来说明电子商务产品及其费率管理。 最佳答案 我同意 Chris Roberts,OSCommerce是一个很好的起点以及DatabaseAnswers.org . 希望对
这个问题之前有人问过here但没有人给用户一个答案。我也遇到了同样的情况,请问有大神解答过吗? 问题又来了: “我是 iOS 的新手,正在构建一个具有应用内购买功能的应用。该应用尚未准备好(不在应用商
我是一名优秀的程序员,十分优秀!