0

我正在尝试提示输入将替换“数据量”值的值

<html>
    <body>
        <a href="http://249lease.webs.com/" class="dwolla_button" data-name="Lease" data-desc="Payments" data-amount="5" data-shipping="0"              data-tax="0" data-guest-checkout="true" data-key="sHqCOc31Vh3JiAsPhBfEk5f4D9bAWKLzwaT06ah3Aw65i0gkZl">Bank Account (25¢)</a>
        <script type="text/javascript" src="https://www.dwolla.com/scripts/button.min.js"> </script>
    </body>
</html>

我已经添加

<script type="text/javascript">
    document.getElementByClass("dwolla_button")[0].setAttribute("data-amount", "43");
</script>  

并在下面这个脚本中尝试了整个事情,但没有任何想法?

<html>
    <body>
        <a href="http://249lease.webs.com/" class="dwolla_button" data-name="Lease" data-desc="Payments" data-amount="5" data-shipping="0"              data-tax="0" data-guest-checkout="true" data-key="sHqCOc31Vh3JiAsPhBfEk5f4D9bAWKLzwaT06ah3Aw65i0gkZl">Bank Account (25¢)</a>
        <script type="text/javascript">
          document.getElementByClass("dwolla_button")[0].setAttribute("data-amount", "43");
        </script>  

        <script type="text/javascript" src="https://www.dwolla.com/scripts/button.min.js"> </script>
    </body>
</html>
4

1 回答 1

1

Change your method from getElementByClassName to getElementsByClassName

 document.getElementsByClassName("dwolla_button")[0].setAttribute("data-amount", "43");
于 2013-03-09T21:06:36.917 回答