当前位置:编程学习 > JS >>

用JSP实现类似资源管理器式的文件与目录的折叠(代码示例)

<%@ page import = "SQLDATA" %>
<%@ page import="java.sql.*" %>
<%@ page contentType="text/html;charset=gb2312" %>
<jsp(SUN企业级应用的首选):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="http://www.rdxx.com/Files/Pic/2007-7/4/KI2H6J5410F993HE6J.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="http://www.rdxx.com/Files/Pic/2007-7/4/5EG8JA3IID0J3I6IFK.gif">");
out.print("<a href=windowsopen.jsp(SUN企业级应用的首选)?indexfile=maogai/"+cc+"&sessionid="+dd+"&zipfile="+ee+"&onlinefile="+ff+">"+bb+"</a></td></tr>");
}
else
{
out.println("<tr><td height=30>    <img border=0 src="http://www.rdxx.com/Files/Pic/2007-7/4/5EG8JA3IID0J3I6IFK.gif">");
out.print("<a href=windowsopen.jsp(SUN企业级应用的首选)?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="http://www.rdxx.com/Files/Pic/2007-7/4/I52C1305307A1F38BH.gif";
self.focus();
}
else
{
divname.style.display = "block";
imgname.src="http://www.rdxx.com/Files/Pic/2007-7/4/G9G2I5BEK1KGBFH187.gif";
self.focus();
}
}
</script>

补充:Web开发 , Jsp ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,