在下面的代码中,我试图在java方法option.value = 中使用var i,但它对我来说工作不是很好。
这里是完整的js功能:
function receiveAnswer(response) {
var aSeats = document.getElementById("aSeats");
while (aSeats.childNodes.length > 0) { // clear it out
aSeats.removeChild(aSeats.childNodes[0]);
}
ppList = (List) session.getAttribute("currentPack"); %>
for (var i = 0; i < response.aSeats.length; i++) { // add the items back in
var option = aSeats.appendChild(document.createElement("option"));
option.setAttribute("type", "hidden");
option.setAttribute("name", "id");
option.setAttribute("value", "")
option.appendChild(document.createTextNode(response.aSeats[i]));
option.value =
}
}