![](/img/trans.png)
[英]How do I assign ticks to be equal to a different key value from the same object from the one on which the axis is based on in D3.js?
[英]How can I use JS to assign a value on an input based on a key?
好吧,拿两个。 在你继续阅读之前,请注意我基本上知道零 JS,所以如果我表现出一些极端的愚蠢,我会尽力而为。
我正在尝试将 ZAD69E733EBCAA8D264BCCAA38D68830E8Z 实施到我正在创建的网站中,并且我在 PayPal 网站上找到了一个按钮,该按钮基本上正是我正在寻找的。
我已经有一个工作车价格计算系统,我已经有一段时间了,它计算销售税/运费/购物车TotalPrice
中物品的总价格,并使用document.getElementByID('ID').innerHTML = `$${localStorage.getItem('TotalPrice')}`
这工作得非常好,并且已经使用了几个月。
PayPal 网站的按钮代码如下:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. --> <input type="hidden" name="business" value="herschelgomez@xyzzyu.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Hot Sauce-12oz. Bottle">
<input type="hidden" name="amount" value="5.95">
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="Buy Now">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" > </form>
提交表单后,实际设置 PayPal 收取的价格的值位于名为“金额”的隐藏输入中。 我认为通过添加一个 ID 并使用与工作车系统类似的逻辑来设置该输入的值会相对容易。 这是我现在拥有的:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="website@gmail.com">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="Checkout">
<input type="hidden" name="amount" id="pricebutton" >
<input type="hidden" name="currency_code" value="USD">
<!-- Display the payment button. -->
<input type="submit" name="submit" border="0" id="checkoutbtn" alt="Buy Now" value="Checkout Using Paypal" onclick="payPal()">
</form>
我还添加了一些 JS
<script>
function payPal() {
document.getElementById('pricebutton').value = localStorage.getItem('TotalPrice');
}
</script>
我尝试做的是,当单击按钮并提交表单时,更改表单的值,使其与购物车中物品的TotalPrice
相匹配。 我做错了什么?
如果您需要更多信息,我将尽我所能通过编辑和评论提供。 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.