假设我有以下代码创建了两个单选按钮:Javascript和HTML - 的onclick
<li id="foli517" class=" ">
<label class="desc" id="shippingChoice" for="Field517_0">
Shipping Options
</label>
<div>
<input id="shippingChoice" name="Field517" type="hidden" value="" />
<span>
<input id="shipping1" name="Field517" type="radio" class="field radio" value="$2.00 Shipping Fee" tabindex="13" checked="checked" />
<label class="choice" for="Field517_0" >
$2.00 Shipping Fee</label>
</span>
<span>
<input id="Field517_1" name="Field517" type="radio" class="field radio" value="I will pick up the items (free shipping)" tabindex="14" />
<label class="choice" for="Field517_1" >
I will pick up the items (free shipping)</label>
</span>
</div>
</li>
我将如何实现一个javascript函数的onclick其更新ID为“mySpan”的跨度内的HTML与单击第二个单选按钮时为“FREE”,否则为“NOT FREE”?
document.getElementById(WHAT GOES HERE).onclick = function() {
//what goes here?
};
请问您可以改进代码格式? – 2011-01-28 01:26:59