<%@ импорт страницы = "SQLDATA" %>
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=gb2312" %>
<jsp:useBean id="sqlbean" class="SQLDATA"scope="session"/>
<html>
<body background="../images/back.jpg">
<p align="center"><font size="6" face="楷体_GB2312">毛泽东思想概论</font></p>
<%
Строка aa,bb,cc,dd,ee,ff;
ResultSet rs=sqlbean.executeQuery("SELECT * FROM MAOGAI");
интервал я = 1, j = 0;
в то время как (rs.next())
{
aa=rs.getString("SECTIONTYPE");
bb=rs.getString("ИМЯ РАЗДЕЛА");
cc=rs.getString("ИНДЕКСФАЙЛ");
ee=rs.getString("ZIPFILE");
ff=rs.getString("ONLINEFILE");
dd=rs.getString("SESSIONID");
if(aa.indexOf('章')>-1)
{
если (j == 1)
{
я=я+1;
out.println("</table></div>");
}
j=0;
out.println(" ");
out.println("<div align='center'>");
out.println("<центр>");
out.println("<table border='0' width='90%' height='0' cellpacing='0' cellpadding='0'>");
out.println("<tr>");
out.println("<td height='0'><img name='img"+String.valueOf(i)+"' border='0' src='../images/fclosed.gif' onclick=' ShowAndHide(div"+String.valueOf(i)+","+"img"+String.valueOf(i)+")'>");
out.print(bb+"</td></tr></table></center></div>");
}
еще
{
если (j==0)
{
j=1;
out.println("<div style='display:none' id=div"+String.valueOf(i)+" align='center'>");
out.println("<центр>");
out.println("<table border='0' width='90%' height='0' cellpacing='0' cellpadding='0'>");
out.println("<tr><td height='30'> <img border='0' src='../images/file.gif'>");
out.print("<a href='windowsopen.jsp?indexfile=maogai/"+cc+"&sessionid="+dd+"&zipfile="+ee+"&onlinefile="+ff+"'>"+bb+"</a> </td></tr>");
}
еще
{
out.println("<tr><td height='30'> <img border='0' src='../images/file.gif'>");
out.print("<a href='windowsopen.jsp?indexfile=maogai/"+cc+"&sessionid="+dd+"&zipfile="+ee+"&onlinefile="+ff+"'>"+bb+"</a> </td></tr>");
}
}
}
%>
</тело>
</html>
<язык сценария=javascript>
функция ShowAndHide(divname,imgname)
{
if (divname.style.display == "блок")
{
divname.style.display = "нет";
imgname.src="../images/fclosed.gif";
сам.фокус();
}
еще
{
divname.style.display = "блок";
imgname.src="../images/fopen.gif";
сам.фокус();
}
}
</script>
转:http://www.cnjsp.org