javascript+jsp数组问题
function showProjname(){
var yearId=window.form.replyYear.options[form.replyYear.selectedIndex].value;
var num=0;
<%
List projList=(List)request.getAttribute( "projList ");
for(int i=0;i <projList.size();i++) {
ProjSheetVO vo2=(ProjSheetVO)projList.get(i);
%>
if( <%=vo2.getReplyYear()%> ==yearId){
num++;
此处相把满足条件的记录存在数组中,在下面的document.all[ "projSheetId "]处输出(如何实现?????)
<%}%>
document.all[ "projSheetId "].options.length = num+1;
alert(num);
<% for(int j=1;j <=num;j++) {%>
document.all[ "projSheetId "].options[j]=new Option( '??? ', '??? ');
<%}%>
}
</script>
------解决方案--------------------function showProjname(){
var yearId=window.form.replyYear.options[form.replyYear.selectedIndex].value;
var num=0;
var result=new Array()
<%
List projList=(List)request.getAttribute( "projList ");
for(int i=0;i <projList.size();i++) {
ProjSheetVO vo2=(ProjSheetVO)projList.get(i);
%>
if( <%=vo2.getReplyYear()%> ==yearId){
result[num]=new Array( ' <%=vo2.get你的东西%> ', ' <%=vo2.get你的东西%> ')
num++;
此处相把满足条件的记录存在数组中,在下面的document.all[ "projSheetId "]处输出(如何实现?????)
<%}%>
document.all[ "projSheetId "].options.length = num+1;
alert(num);
<% for(int j=1;j <=num;j++) {%>
document.all[ "projSheetId "].options[j]=new Option(result[j][0],result[j][1]);
<%}%>
}
</script>