script src http ajax googleapis com ajax libs jquery jquery min js scr

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
function calculateBonuses() {
var coinPrice = parseFloat($('#unitpayForm #coinPrice').val());
var coins = parseInt($('#unitpayForm #coins').val());
if (isNaN(coins) || isNaN(coinPrice) || coins <= 0) {
$('#unitpayForm #sum').val('');
return;
}
var price = coins * coinPrice;
if (price > 15000) {
price = 15000;
}
$('#unitpayForm #sum').val(price);
}
$('#unitpayForm input#coins').keyup(function () {
calculateBonuses();
});
calculateBonuses();
$('#unitpayForm').submit(function(){
var sum = parseFloat($('#unitpayForm #sum').val());
if (isNaN(sum) || sum <= 0 || sum > 15000) {
alert('Неверная сумма платежа');
return false;
}
});
});
</script>
<form id="unitpayForm" action="https://unitpay.ru/pay/2965-3deb2" method="post">
<label for="account">Ник персонажа:</label> <input type="text" value="" name="account" required="required" id="account">
<label for="coins">Количство монет:</label>
<input type="text" id="coins" name="coins" value="10" required="required">
<input type="hidden" id="sum" name="sum" value="">
<input type="hidden" id="coinPrice" name="coinPrice" value="30">
<input type="hidden" name="desc" value="Покупка внутриигровой валюты">
<input type="submit" class="btn" value="Оплатить">
</form>