/** * Check if there is a duplicate of the amount entered*/functioncheckrangerepeat () {varMoneyoutarr =NewArray (); varMoneyoutmap = {}; $("Input[name= ' moneyminout ']"). each (function(index) {Moneyoutarr[index]= Parsefloat ($ ( This). Val ()); }); $("Input[name= ' moneymaxout ']"). each (function(index) {if(Moneyoutarr[index]inchMoneyoutmap) {Layer.open ({content:' Payment rules cannot be repeated! ' }); return false; } Moneyoutmap[moneyoutarr[index]]= Parsefloat ($ ( This). Val ()); }); //Release rule scope non-duplicate check //sort from small to largeMoneyoutarr.sort (function(A, b) {returna > B? 1:-1 }); for(vari = 0; i < moneyoutarr.length-1; i++) { varStartmoney =Moneyoutarr[i]; varEndmoney =Moneyoutmap[startmoney]; varStartmoneynext = moneyoutarr[i + 1]; varEndmoneynext =Moneyoutmap[startmoneynext]; if(Startmoney > Endmoney | | startmoneynext >Endmoneynext) {Layer.open ({content:' The minimum amount of the distribution rules must not be greater than the maximum amount of consumption! ' }); return false; } if(Endmoney >=Startmoneynext) {Layer.open ({content:' Payment rules cannot be repeated! ' }); return false; } }}
JS Check whether the amount of input is duplicated