我想让我的账单字段自动匹配我的运输字段。我可以使它与文本值一起使用,但我不能自动填充无线电按钮。我正在使用此代码: http: //jsfiddle.net/aDNH7/我想将其保留在 Javascript 中。
<script>
function FillBilling(f) {
if(f.billingtoo.checked == true) {
f.billingname.value = f.shippingname.value;
f.billingcity.value = f.shippingcity.value;
}
if(f.billingtoo.checked == false) {
f.billingname.value = '';
f.billingcity.value = '';
}
}
</script>
<td bgcolor="eeeeee">
<b>Mailing Address</b>
<br><br>
<form>
Name:
<input type="text" name="shippingname">
<br>
City:
<input type="text" name="shippingcity">
/> 检查
/> 储蓄
<br>
<input type="checkbox" onclick="FillBilling(this.form)" name="billingtoo">
<em>Check this box if Billing Address and Mailing Address are the same.</em>
<p>
<b>Billing Address</b>
<br><br>
Name:
<input type="text" name="billingname">
<br>
City:
<input type="text" name="billingcity">
/> 检查
/> 储蓄
BUT, I want to add this to the form for both the BILLING and SHIPPING. And then I want the SHIPPING one to match up with the BILLING one if I check the box.
<!-- <td colspan="2"><p>
<label>
<input type="radio" name="acct" value="checking" id="acct_0" <?php if ($user_info['acct'] == "checking"){ echo "checked='checked'"; }?>/>
Checking</label>
<br />
<label>
<input type="radio" name="acct" value="savings" id="acct_1" <?php if ($user_info['acct'] == "savings"){ echo "checked='checked'"; }?>/>
Savings</label>
<br />
</p>
</td>-->