document.getElementById().value会返回什么值?
在我的JSP中有这样一段代码:<selectname="leaveDetail.leavetype0"id="leavetype0"><optionvalue=""></...
在我的JSP中有这样一段代码:
<select name="leaveDetail.leavetype0" id="leavetype0">
<option value=""></option>
<c:forEach items="${leaveTypeMap}" var="leaveType" >
<option value="${leaveType.value} " <c:if test="${leaveType.value == selectLeave.leaveType }">selected</c:if>>
${leaveType.value}</option>
</c:forEach>
</select>
leaveType的值依次是:"","事假","带薪年假","病假","婚嫁","产假","丧假","陪护假"。
后来,我想调用if(document.getElementById("leavetype0").value=="带薪年假"){...},但是不管我在网页选择的是什么,这个条件都不成立?怎么办? 展开
<select name="leaveDetail.leavetype0" id="leavetype0">
<option value=""></option>
<c:forEach items="${leaveTypeMap}" var="leaveType" >
<option value="${leaveType.value} " <c:if test="${leaveType.value == selectLeave.leaveType }">selected</c:if>>
${leaveType.value}</option>
</c:forEach>
</select>
leaveType的值依次是:"","事假","带薪年假","病假","婚嫁","产假","丧假","陪护假"。
后来,我想调用if(document.getElementById("leavetype0").value=="带薪年假"){...},但是不管我在网页选择的是什么,这个条件都不成立?怎么办? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询