假设我有以下代码创建两个单选按钮:
<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,该函数使用单词“FREE”更新 id 为“mySpan”的 span 的内部 html,否则为“NOT FREE”?
document.getElementById(WHAT GOES HERE).onclick = function() {
//what goes here?
};