如果單選按鈕2被選中,則將輸入框添加到日期設置中。我如何添加輸入框?如果單選按鈕1被選中,則除了先前選中按鈕2以外,什麼也不做。你能幫我Javascript幫助。添加/刪除表單元素到DOM
感謝
function CheckDateOptions() {
var o1 = document.getElementById("dateoption1");
var o2 = document.getElementById("dateoption2");
var eSettings = document.getElementById("datesettings");
if(o1.checked) {
//Remove o2 children
}
else if(o2.checked) {
//How do I add an input box?
}
}
<input type="radio" id="dateoption1" name="dateoption" value="1" onclick="CheckDateOptions();">
<input type="radio" id="dateoption2" name="dateoption" value="2" onclick="CheckDateOptions();">
<span id="datesettings">//Add input box here if dateoption2 is checked</span>
真棒!去raibh maith agat :) – Jonathan 2010-09-17 21:55:34
Táfáilteromhat :) – irishbuzz 2010-09-17 22:00:08