<%
int[] temp = new int[2];
temp[0] = 1;
temp[1] = 2;
%><input type="button" name="test" value="查看列表" onclick="ShowEquipmentExecute(<%=temp%>)"/>javascript 函数该怎么写?
function ShowtempArray()
{

}

解决方案 »

  1.   

    function ShowtempArray()
    {
        var i=<%=temp.length%>
        var test=new Array(i);
        for(var j=0;j<i;j++)
        {
             test[j]=<%=temp[j]%>
        }
        /*下面就可以使用数组了!*/
    }
      

  2.   

    <%@ page contentType="text/html; charset=GBK" %>
    <%
    int[] temp = new int[2];
    temp[0] = 1;
    temp[1] = 2;
    %>
    <script>
       var t=[];
    <%
        for(int i=0;i<temp.length;i++){  
    %>      
           t[<%=i%>]=<%=temp[i]%>;
    <%
       }
    %>
       alert(t);
    </script>