求助:点击按钮, onClick事件不反映,盼高手指点
点击"增加选项" "减少选项" 按钮均无反应,高手帮忙分析,急等,多谢了var ul=document.getElementById("ulAnswer");
var input=document.createElement("input");
var li=document.createElement("li");
input.setAttribute("id","Answer");
li.appendChild(input);
ul.appendChild(li);
}
function LessAnswer(){
var ul=document.getElementById("ulAnswer");
var li=ul.lastChild;
if (ul.firstChild==li){
alert("最后一个选项不能删除");
}
else {
ul.removeChild(li);
}
}
</script>
<p>请选择题目类型:
<form name="form1" method="post" action="QuestionSave.asp">
<select name="select" ><option value="1">单选 </option>
<option value="2">多选 </option>
<option value="3">单选+文字输入 </option>
<option value="4">多选+文字输入 </option>
<option value="4">问答题 </option>
</select>
<P>问题:
<input type="text" name="textfield">
<ul>
<li><input type="text" name="Answer"></li>
<li><input type="text" name="Answer"></li>
<li><input type="text" name="Answer"></li>
<li><input type="text" name="Answer"></li>
</ul></p>
<p align="center">
<input type="button" name="MoreAnswer1" value="增加选项" onClick="MoreAnswer();">
<input type="button" name="LessAnswer1" value="减少选项" onClick="LessAnswer();">
<input type="submit" value="添加题目">
</p>
</form>