提示:我不是希望大家在这里找到我问题的100%解决方案,但是正确的代码指导我会选择实施其余的。
可以找到参考的网页here
The Problem
If you click on the link, you see a section with input boxes, a Price of Phone box
and B!-B4, T1 to T4 boxes..
The task is this, The System Admin are going to be able to input values into this boxes.
Price of Phone 700
B1 600 B2 500 B3 899 B4 900 **(these prices are fixed and would be disabled)**
所以用户1:
如果用户1希望该术语持续12个月
所以它将变为A = {电话价格/ 12个月}
存储此值
if 12months is selected:
var a= (Price of Phone/12months)
{
if B1:{
var b = $("#b1").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B2:{
var b = $("#b2").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B3:{
var b = $("#b3").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B4:{
var b = $("#b3").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
}
elseif 24months is selected:
var a= (Price of Phone/24months)
{
if B1:{
var b = $("#b1").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B2:{
var b = $("#b2").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B3:{
var b = $("#b3").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
elseif B4:{
var b = $("#b3").val();
if 6months:{
do this
var c = (b/6);
}else if 12months:{
do this
var c = (b/12);
}else if 18monts:{
do this
var c = (b/18);
}else{
do this
var c = (b/24);
}
}
}
function() {
var total = (a) + (c) + (any other hidden charges)
var monthly = total / 12;
var weekly = total / 52;
$('#total').val(total);
$('#total12').val(monthly);
$('#total52').val(weekly);
}
我可以请求Jquery代码来解决这个问题,我可以找到我当前的jquery代码here,你可以从那里改进它。
答案 0 :(得分:0)
如果我理解正确的话;你想要挤出总价值'这些可变用户选项。
您需要的是 [HttpPost]
public HttpResponseMessage Post(foodcls[] fods)
,可以执行此计算,每次更改选项时都会调用此计算。
这样的事情:
function
Here's another pastebin以及使用示例。