在此页面下拉列表选中题库点击button按钮 触发onclick到后台查询数据再加载到这个页面中,在选中下拉列表点击按钮式onclick事件不触发了这个图关键代码:
function changeQuestionGroup(){
var groupId=document.getElementById("questionGroup").value;
var paperId=document.getElementById("paperId").value;
alert(paperId);
location.href="${ctx}/exam/changeQuestionGroup.action?groupId="+groupId+"&paperId="+paperId;
}<c:if test="${empty list }">
<tr>
<td>无数据!</td>
</tr>
</c:if>
<c:if test="${!empty list }">
<tr>
<td>选择题库:</td>
<td>
<select id="questionGroup" name="testPaperInfoVO.questionGroup">
<c:forEach items="${list }" var="l">
<option value="${l.groupId }">${l.name }</option>
</c:forEach>
</select>
<input type="button" name="questionButton" id="questionButton" value="选择试题" onclick="changeQuestionGroup()"></input>
</td>
</tr>
</c:if>
function changeQuestionGroup(){
var groupId=document.getElementById("questionGroup").value;
var paperId=document.getElementById("paperId").value;
alert(paperId);
location.href="${ctx}/exam/changeQuestionGroup.action?groupId="+groupId+"&paperId="+paperId;
}<c:if test="${empty list }">
<tr>
<td>无数据!</td>
</tr>
</c:if>
<c:if test="${!empty list }">
<tr>
<td>选择题库:</td>
<td>
<select id="questionGroup" name="testPaperInfoVO.questionGroup">
<c:forEach items="${list }" var="l">
<option value="${l.groupId }">${l.name }</option>
</c:forEach>
</select>
<input type="button" name="questionButton" id="questionButton" value="选择试题" onclick="changeQuestionGroup()"></input>
</td>
</tr>
</c:if>
}就可以了
var groupId=obj.options[obj.selectedIndex].value;