2014-11-06 81 views
1

我有一个函数,它可以计算总计如何使用javascript将数据量的值更改为总计数量?如何从JavaScript更改PayPal金额值?

<script data-env="sandbox" 
        data-currency="NZD" 
        data-button="buynow" src="https://www.paypalobjects.com/js/external/[email protected]" 
        async="async" 
        data-amount="0"> 

      </script> 

任何帮助将是巨大的

+0

你能告诉我们你的Javascript有这么远吗? – thatidiotguy 2014-11-06 20:41:22

回答

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"); 
+0

感谢它的工作,我所要做的就是将[0]更改为[3],并且效果很好。 – 2014-11-06 21:07:09