0

我在页面上有一个输入(单选按钮)及其标签。此标签附加了 onClick,以便通过单击标签来设置收音机。如果我在页面上有一次这样的东西一切都好,但如果我有两次收音机+标签,那么点击第二个标签会设置第一个收音机。代码看起来是这样的:

   <input id="shipping_<?php echo $rate['element']; ?>" name="shipping_plugin" rel="<?php echo $rate['name']; ?>" type="radio" value="<?php echo $rate['element'] ?>" onClick="k2storeSetShippingRate('<?php echo $rate['name']; ?>','<?php echo $rate['price']; ?>',<?php echo $rate['tax']; ?>,<?php echo $rate['extra']; ?>, '<?php echo $rate['code']; ?>', true );" <?php echo $checked; ?> />
   <label for="shipping_<?php echo $rate['element']; ?>" onClick="k2storeSetShippingRate('<?php echo $rate['name']; ?>','<?php echo $rate['price']; ?>',<?php echo $rate['tax']; ?>,<?php echo $rate['extra']; ?>, '<?php echo $rate['code']; ?>', true );"><?php echo $rate['name']; ?> ( <?php echo K2StorePrices::number( $rate['total']); ?> )</label>

对于如何运行这个 onClick 的任何建议,我很高兴,以便第二次出现设置正确,自己的收音机。

谢谢!埃贡

4

1 回答 1

0

Input and label must be formatted as following code:

<label><input id="shipping_<?php echo $rate['element']; ?>" name="shipping_plugin" rel="<?php echo $rate['name']; ?>" type="radio" value="<?php echo $rate['element'] ?>" onClick="k2storeSetShippingRate('<?php echo $rate['name']; ?>','<?php echo $rate['price']; ?>',<?php echo $rate['tax']; ?>,<?php echo $rate['extra']; ?>, '<?php echo $rate['code']; ?>', true );" <?php echo $checked; ?> >&nbsp;<?php echo $rate['name']; ?></label>
于 2013-10-08T20:18:33.050 回答