<%@ 頁導入 = "SQLDATA" %>
<%@ page import="java.sql.*" %>
<%@ 頁面 contentType="text/html;charset=gb2312" %>
<jsp:useBean id="sqlbean" class="SQLDATA" range="session"/>
<html>
<body background="../images/back.jpg">
<palign="center"><font size="6"face="楷體_GB2312">毛澤東思想概論</font></p>
<%
字串 aa,bb,cc,dd,ee,ff;
ResultSet rs=sqlbean.executeQuery("SELECT * FROM MAOGAI");
int i=1,j=0;
while(rs.next())
{
aa=rs.getString("SECTIONTYPE");
bb=rs.getString("SECTIONNAME");
cc=rs.getString("INDEXFILE");
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;
輸出.println(“”);
out.println("<divalign='center'>");
out.println("<中心>");
out.println("<表格邊框='0'寬度='90%'高度='0'cellspacing='0'cellpadding='0'>");
out.println("<tr>");
out.println("<td height='0'><img name='img"+String.valueOf(i)+"' border='0' src='../images/fclose.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("<表格邊框='0'寬度='90%'高度='0'cellspacing='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/fclose.gif";
self.focus();
}
別的
{
divname.style.display = "區塊";
imgname.src="../images/fopen.gif";
self.focus();
}
}
</script>
轉:http://www.cnjsp.org