如果不符合条件(JavaScript)

时间:2018-10-22 03:26:41

标签: javascript html

使用JavaScript和HTML创建SharePoint Portal,问题出在我输入大约100,000至800,000的数字时; ex(523,546)它将在第一个if条件中输入并在下面执行以下语句。即使该值小于给定的MDV“估算的总运费”。

输入pagetdv的值。

var pagetdvz = document.getElementById('pagetdv');
var pagesrz = document.getElementById('pagesr');
var pagemdvz = document.getElementById('pagemdv');

/ ------------最大声明值---------- /

if (document.getElementById('dropct').selectedIndex == 0)
document.getElementById('pagemdv').value = 1500000;

else if (document.getElementById('dropct').selectedIndex == 1)
document.getElementById('pagemdv').value = 3000000;

/ ------------目标+ 20 Ftr ---------- /

if ((document.getElementById('dropdest').selectedIndex == 0) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 45900;

else if ((document.getElementById('dropdest').selectedIndex == 1) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 50000;

else if ((document.getElementById('dropdest').selectedIndex == 2) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 46700;

else if ((document.getElementById('dropdest').selectedIndex == 3) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 47583.67;

else if ((document.getElementById('dropdest').selectedIndex == 4) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 59981.33;

else if ((document.getElementById('dropdest').selectedIndex == 5) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 45900;

else if ((document.getElementById('dropdest').selectedIndex == 6) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 59000;

else if ((document.getElementById('dropdest').selectedIndex == 7) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 45900;

else if ((document.getElementById('dropdest').selectedIndex == 8) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 59,981.33;

else if ((document.getElementById('dropdest').selectedIndex == 9) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 58500;

else if ((document.getElementById('dropdest').selectedIndex == 10) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 49000;

else if ((document.getElementById('dropdest').selectedIndex == 11) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 46700;

else if ((document.getElementById('dropdest').selectedIndex == 12) && (document.getElementById('dropct').selectedIndex == 0))
    document.getElementById('pagesr').value = 51000;

/ ------------目标+ 40 Ftr ---------- /

if ((document.getElementById('dropdest').selectedIndex == 0) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 89600;

else if ((document.getElementById('dropdest').selectedIndex == 1) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 95500;

else if ((document.getElementById('dropdest').selectedIndex == 2) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 91096.87;

else if ((document.getElementById('dropdest').selectedIndex == 3) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 94944.66;

else if ((document.getElementById('dropdest').selectedIndex == 4) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 119739.26;

else if ((document.getElementById('dropdest').selectedIndex == 5) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 89600;

else if ((document.getElementById('dropdest').selectedIndex == 6) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 117487.73;

else if ((document.getElementById('dropdest').selectedIndex == 7) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 89600;

else if ((document.getElementById('dropdest').selectedIndex == 8) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 119739.26;

else if ((document.getElementById('dropdest').selectedIndex == 9) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 113000;

else if ((document.getElementById('dropdest').selectedIndex == 10) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = "--Null--";

else if ((document.getElementById('dropdest').selectedIndex == 11) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = 91096.87;

else if ((document.getElementById('dropdest').selectedIndex == 12) && (document.getElementById('dropct').selectedIndex == 1))
    document.getElementById('pagesr').value = "--Null--";

/ ------------预计总货运量---------- /

if (document.getElementById('pagetdv').value > document.getElementById('pagemdv').value){
var tdva = parseFloat(pagetdvz.value) - parseFloat(pagemdvz.value);
var tdvb = tdva / 1000;
var tdvc = tdvb * 3.36;
var tef = tdvc + parseFloat(pagesrz.value);
  document.getElementById('pagetef').value = tef;
  } 
else if (document.getElementById('pagetdv').value <= document.getElementById('pagemdv').value)
document.getElementById('pagetef').value = document.getElementById('pagesr').value;

0 个答案:

没有答案