<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="java.lang.String.*"%>
<%
if(request.getParameter("submit")!=null)
{
String checkbox[]=request.getParameterValues("checkbox");
if (checkbox!=null)
{
//int size=java.lang.reflect.Array.getLength(checkbox);
int size=checkbox.length;
out.println("您选中了" + size + "项,分别为:<br>");
for (int i=0;i<size;i++)
{
out.println(checkbox[i]+"<br>");
}
}
}
%>
<form name=form1 action="" method=post>
<script langauge=javascript>
for(i=0;i<20;i++)
{
document.writeln("<input type=checkbox name=checkbox value=\""+ i +"\"><label for=checkbox" + i + ">选择"+ i +"</label><br>");
}
</script>
<br>
<input type=submit value="提交" name="submit">
</form>