我有一个函数来计算总计如何使用javascript将数据量的值更改为总计金额?
<script data-env="sandbox"
data-currency="NZD"
data-button="buynow" src="https://www.paypalobjects.com/js/external/paypal-button.min.js?merchant=test@test.com"
async="async"
data-amount="0">
</script>
任何帮助都会很棒
答案 0 :(得分:1)
如果您的意思是data-amount
...
var scr=document.getElementsByTagName("script")[0]; // assuming that this <script> is first <script> on this page
scr.setAttribute("data-amount", "some new value");