【发布时间】:2026-02-04 09:20:09
【问题描述】:
在下面的 sn-p 中,我希望它根据用户选择的样式更改价格。
所以对于样式 1,价格是:1 美元、2 美元和 3 美元。 对于样式 2,价格为:4 美元、5 美元和 6 美元。 款式 3 的价格分别为:7 美元、8 美元和 9 美元。
如何修改该代码以使其更改价格,具体取决于选择的样式?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="testtest@hotmail.com">
<input type="hidden" name="lc" value="BM">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<table>
<tr>
<td>
<input type="hidden" name="on1" value="Which style?">Which style?</td>
</tr>
<tr>
<td>
<select name="os1">
<option value="Style 1">Style 1</option>
<option value="Style 2">Style 2</option>
<option value="Style 2">Style 2</option>
</select>
</td>
</tr>
<tr>
<td>
<input type="hidden" name="on0" value="How many?">How many?</td>
</tr>
<tr>
<td>
<select name="os0">
<option value="10 -">10 - $1.00 USD</option>
<option value="100 -">100 - $2.00 USD</option>
<option value="1000 -">1000 - $3.00 USD</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="10 -">
<input type="hidden" name="option_amount0" value="1.00">
<input type="hidden" name="option_select1" value="100 -">
<input type="hidden" name="option_amount1" value="2.00">
<input type="hidden" name="option_select2" value="1000 -">
<input type="hidden" name="option_amount2" value="3.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
【问题讨论】:
-
为了实现这一点,您必须使用 javascript 并根据第一个选择修改第二个下拉菜单,或者使用非常 hacky 的 CSS 隐藏一些选项。
-
知道怎么做吗?哈哈。我刚刚学习了html和css,所以我可以制作像样的网站。但是还没有进入js,因为我现在没有时间。但我真的需要完成这个。
-
我不知道任何javascript。我只是想为我的家族企业完成网站......我现在根本没有时间开始学习javascript,只是为了完成这一件事。并希望我可以避免为此付钱给某人。至少值得尝试找人帮忙。无论如何,谢谢。
-
@Miqro 为什么不使用 Jquery。这是一个超级容易学习的 JavaScript 库。
标签: html button data-binding drop-down-menu