Skip to content

Instantly share code, notes, and snippets.

@starckio
Created October 20, 2016 10:20
Show Gist options
  • Save starckio/d44d7148c7ff4ef03d43f9c3fa554cca to your computer and use it in GitHub Desktop.
Save starckio/d44d7148c7ff4ef03d43f9c3fa554cca to your computer and use it in GitHub Desktop.
Systeme de donation PayPal - For GetKirby-Themes.com
function getEventTarget(e) {
e = e || window.event;
return e.target || e.srcElement;
}
function removeClass (argument) {
for (var i = argument.length - 1; i >= 0; i--) {
argument[i].className = ""
}
}
function selectUSD(){
var options = document.getElementById("options")
removeClass(document.getElementsByTagName("li"))
var activeAmount = getEventTarget(event)
activeAmount.className = "active"
document.getElementsByName("amount")[0].value = activeAmount.innerHTML
}
<form name="_xclick" action="https://www.paypal.com/fr/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Donate">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="5">
<ul id="options">
<li onclick="selectUSD()" class="">1</li>
<li onclick="selectUSD()" class="active">5</li>
<li onclick="selectUSD()" class="">10</li>
<li onclick="selectUSD()" class="">20</li>
</ul>
<button type="submit" border="0" name="submit">Donate</button>
</form>
<?php echo js('assets/js/donate.js') ?>
@jonabaptistella
Copy link

Hi, I tried to style it up today. Looks good and works perfect. I will add that and all the themes to the page hopefully this weekend. PS: It is 01:14 at night here... 😸
donate-paypal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment