JavaScript calculations
JavaScript calculations
本文关键字:calculations JavaScript 更新时间:2023-09-26
这是我的代码的更新版本。我只能在浏览器的控制台中看到p//pay rate和m//markup%的值,它们不会显示在表单loandata的指定字段中。
var b, p, m, pmp, pm, pb, fp, misc, wc, tax, sui, o, fp, misc, t;
function calculate1(){
wc = document.set.wc.value; // workers comp %
tax = document.set.tax.value; // taxes %
sui = document.set.sui.value; // sui %
o = document.set.o.value; // other expenses %
fp =document.set.fp.value; // fund and processing %
misc = document.set.misc.value; // Misc expenses %
pb = (wc+tax+sui+o)/100*b; // variable used to calculate profit margin
document.set.pb.value = pb;
t = document.set.t.value; // target profit margin %
}
function calculate() {
b = document.loandata.b.value; //bill rate
b = (b=="")?(((m*p)/ 100) + p):b;
p = document.loandata.p.value; //pay rate
m = document.loandata.m.value; // markup %
m = (m=="")?((b-p)/p* 100):m;
pm = (b-((pb*p)/100+(b*fp)/100+(b*misc)/100+p)); // profit margin calculation
pm = Math.round(pm).toFixed(2);
document.loandata.pm.value = pm;
pmp = pm/b*100; // profit margin % calc
pmp = Math.round(pmp).toFixed(2); // profit margin %
document.loandata.pmp.value = pmp;
}
m = (m==undefined)?(formula for m):m;
p = (p==undefined)?(formula for p):p;
相关文章:
- 使用ja将对象添加到HTML画布中
- 如何从document.getElementsByClassName('myTxtBox');中获取ja
- NaN with 6 calculations
- BMI calculations
- jQuery / JavaScript calculations
- 在 Jsctypes 中将 char * 从 javascript 传递到 c,并将 char * 从 c 传递到 ja
- 是否可以避免使用getter和setter的模式,并且仍然使用闭包ADVANCED_OPTIMIZATIONS最小化Ja
- jQuery Calculations-如何根据发送到一个数量字段的合计触发多个折扣条件
- 如何重置“;readonly=true”;从php创建的表单中的输入字段为“”;readonly=false”;使用ja
- PDF javascript calculations
- JavaScript calculations
- 无法在chrome本地存储中使用jquery,如何使用.remove() jquery方法的css:有伪选择器只使用ja
- 使用ja/jQuery提交表单,并停留在同一页面
- “test”和“test”有什么区别?Javascript变量和"#test"变量可以将var ja
- What's the difference between & and && in Ja
- 32.48 * 10 = 324.79999999999995 in javascript calculations
- chrome中的Javascript window.print(),关闭新窗口或选项卡而不是取消打印会在父窗口中阻止Ja
- Jquery - customize ui.ja
- 带有Hierarchy的Telerik radgrid不会在OnHierarchyExpanding事件上运行客户端ja