Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form id="ov-donation-form" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
- <input type="hidden" name="cmd" value="_donations">
- <input type="hidden" name="business" value="tu_correo_paypal">
- <input type="hidden" name="return" value="url_pagina_gracias">
- <!-- <input type="hidden" name="currency_code" value="USD"> -->
- <label>Selecciona la cantidad a donar:</label>
- <div id="ov-group-buttons">
- <button type="button" class="ov-donation-button" data-amount="5">$5</button>
- <button type="button" class="ov-donation-button" data-amount="50">$50</button>
- <button type="button" class="ov-donation-button" data-amount="100">$100</button>
- <button type="button" class="ov-donation-button" data-amount="200">$200</button>
- <button type="button" class="ov-donation-button" data-amount="500">$500</button>
- <button type="button" class="ov-donation-button" data-amount="800">$800</button>
- <button type="button" class="ov-donation-button" data-amount="1000">$1000</button>
- </div>
- <label>Ingresa otra cantidad:</label>
- <input type="number" name="custom-amount" id="custom-amount" placeholder="Cantidad personalizada">
- <input type="hidden" name="amount" id="selected-amount" value="">
- <button type="submit" id="ov-donate-button">Donar</button>
- </form>
- <script>
- document.querySelectorAll('.ov-donation-button').forEach(button => {
- button.addEventListener('click', function() {
- var selectedAmount = this.getAttribute('data-amount');
- document.getElementById('selected-amount').value = selectedAmount;
- document.getElementById('custom-amount').value = '';
- document.querySelectorAll('.ov-donation-button').forEach(btn => {
- btn.classList.remove('selected');
- });
- this.classList.add('selected');
- document.getElementById('ov-donate-button').innerText = 'Donar $' + selectedAmount + ' MXN';
- });
- });
- document.getElementById('custom-amount').addEventListener('input', function() {
- var customAmount = this.value;
- document.getElementById('selected-amount').value = customAmount;
- document.querySelectorAll('.ov-donation-button').forEach(btn => {
- btn.classList.remove('selected');
- });
- document.getElementById('ov-donate-button').innerText = 'Donar $' + customAmount + ' MXN';
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement