我有一个网站:http://communitychessclub.com/cccr-pairing/account.html我希望非会员的EF(入场费)为5美元。基于会员的费用为YYYY.MM.DD和普通会员3美元。我需要能够用我选择的任何一个整数覆盖EF量。有人可以帮忙吗?
<script src="assets/PLAYERS.JS"></script>
<script src="assets/MEMBERS.JSON"></script>
var members = [
{"Name": "Ahmed, Jamshed", "Expires": "2017.10.05"},
{"Name": "Attaya, James", "Expires": "2018.01.12"},
...
{"Name": "Wells, Lucas", "Expires": "2016.08.25"},
{"Name": "Worl, David", "Expires": "2018.01.10"}
];
HTML:
<!-- start player arrival -->
<div class="universal">
<div class = "cucumber"></div><div class = "ui-widget glasnost">
<input type = "text" id = "P01" placeholder="Last, First" maxlength = "25" class = "automplete-2 text person" autofocus > </div>
<div class="EF">EF $ <input type="text" onblur="findTotalEF()" name = "ef-fee" style="margin-right:1rem; width:1rem;" class="number fee fee_amt" maxlength = "1" size = "1"></div>
<div class="MEM">MEM $ <input type="text" onblur="findTotalMem()" name = "mem-fee" class="number fee" maxlength = "2" size = "2"></div>
<div class="EXP">EXP <input type="text" id="X01" name = "expires" class="number fee expDate" maxlength = "12" size = "12" disabled></div></div>
var members = [
{"Name": "Ahmed, Jamshed", "Expires": "2017.10.05"},
{"Name": "Attaya, James", "Expires": "2018.01.12"},
...
{"Name": "Wells, Lucas", "Expires": "2016.08.25"},
{"Name": "Worl, David", "Expires": "2018.01.10"}
];
<script> // Lookup date of expiration
function getExpireDate(ele) {
var i = null;
for (i = 0; members.length > i; i++) {
if (members[i].Name == ele.value) {
var exDate = moment(members[i].Expires, 'YYYY.MM.DD');
if (moment().isAfter(exDate)) {
$(ele).closest('.universal').find('.expDate').css('color', "#FF0000");
} else {
$(ele).closest('.universal').find('.expDate').css('color', "#1EDD59");
}
return members[i].Expires;
}
}
return;
}
// Lookup date of expiration
$("#P01").on("blur", function(){$("#X01").val(getExpireDate(this));});
$("#P02").on("blur", function(){$("#X02").val(getExpireDate(this));});
$("#P03").on("blur", function(){$("#X03").val(getExpireDate(this));});
$("#P04").on("blur", function(){$("#X04").val(getExpireDate(this));});