繁体   English   中英

如何在 document.getElementById 中传递固定的 integer 值

[英]How can I pass a fixed integer value in document.getElementById

这是我的代码。 我想使用固定的 integer 值而不是“package_select”。 我怎样才能做到这一点...

<script>
      paypal.Buttons({
        createOrder: function(data, actions) {
          // This function sets up the details of the transaction, including the amount and line item details.
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: document.getElementById("package_select").value
              }
            }]
          });
        },
        onApprove: function(data, actions) {
          // This function captures the funds from the transaction.
          return actions.order.capture().then(function(details) {
            // This function shows a transaction success message to your buyer.
            alert('Transaction completed by ' + details.payer.name.given_name);
          });
        }
      }).render('#paypal-button-container');
      //This function displays Smart Payment Buttons on your web page.
    </script>
          amount: {
            value: REPLACE_WITH_FIXED_INTEGER_VALUE
          }

https://developer.paypal.com/demo/checkout/#/pattern/client查看完整演示

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM