0

我正在开发一个 Web 应用程序,我必须在其中集成一个 Paypal 帐户。页面上有许多单选按钮,代表各种积分及其价格等。我的问题是,我想要一些功能,通过它我可以在单选按钮单击之一上设置各种其他表单字段。每个单选按钮的这些值都不同。

<form action='<?php echo $paypal_url; ?>' method='post' name='form'>
    <div class="crea_paka_title">Creadit Pakages</div>
    <?php
    foreach($admin_credits as $credits){ 
    ?>
        <div class="creadit_fields">
            <span class="for_radio">
                <input type="radio" name="1" id="<?php echo $credits['AdminCredit']['id'];?>" value="" />
            </span>
            <span class="for_creadit">
                <?php echo $credits['AdminCredit']['tx_total_credits']; ?> Credits
            </span>
            <span class="for_cre_value">
                $<?php echo $credits['AdminCredit']['nu_total_price']; ?>
            </span>
        </div>
        <div style="clear:both;"></div>
    <?php
    }
    ?>
<input type='hidden' name='business' value='<?php echo $paypal_id; ?>'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='<?php echo $credits['AdminCredit']['tx_total_credits'];?> Credits'>
<input type='hidden' name='item_number' value='<?php echo $credits['AdminCredit']['id'];?>'>
<input type='hidden' name='amount' value='<?php echo $credits['AdminCredit']['nu_total_price'];?>'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>

就像上面在我的代码中一样,我必须更改单选按钮单击时的输入值。任何建议表示赞赏。

在此处输入图像描述

4

1 回答 1

0

jQuery 会这样做:

$("#rbID").click(finction(){
  $("otherRB").attr("checked",true);
});
于 2012-07-17T11:09:31.133 回答