用JSP實作類別似資源管理員式的檔案與目錄的摺疊(程式碼範例)

來源:互聯網
上載者:User
js|樣本 <%@ page import = "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>
<%
String 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)
{
if(j==1)
{
i=i+1;
out.println("</table></div>");
}
j=0;
out.println(" ");
out.println("<div align='center'>");
out.println("<center>");
out.println("<table border='0' width='90%' height='0' cellspacing='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>");
}
else 
{
if(j==0)
{
j=1;
out.println("<div style='display:none' id=div"+String.valueOf(i)+" align='center'>");
out.println("<center>");
out.println("<table border='0' width='90%' height='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>");
}
else
{
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>");
}
}

}
%>
</body>
</html>
<script language=javascript>
function ShowAndHide(divname,imgname)
{
if (divname.style.display == "block") 
{
divname.style.display = "none";
imgname.src="../images/fclosed.gif";
self.focus();

else 
{
divname.style.display = "block";
imgname.src="../images/fopen.gif";
self.focus();
}
}
</script> 


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.