在框架中,可以实现折叠框架效果代码

Main.htm
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
</head>
<frameset rows="102,*" frameborder="NO" border="0" framespacing="0" name="topset">
<frame name="topFrame" scrolling="NO" noresize src="Top.aspx">
<frameset rows="*" cols="204,*" framespacing="0" frameborder="no" border="0" name="middleset">
<frame name="leftFrame" noresize src="left.aspx">
<frameset rows="*" cols="5,*" framespacing="0" frameborder="NO" border="0">
<frame src="spliter.aspx" name="spliterFrame" scrolling="NO" noresize>
<frame name="mainFrame" src="Main.aspx">
</frameset>
</frameset>
</frameset>
<noframes>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</noframes>
</html>


Top.aspx为顶部页
left.aspx为左边菜单页
spliter.aspx为控制页(控制left.aspx)
Main.aspx为默认内容页


spliter.aspx
<%@ Page language="c#" Codebehind="Spliter.aspx.cs" AutoEventWireup="false" Inherits="LiTianPing.Web.Spliter" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

<html>
  <head>
    <title>Spliter</title>
    <style type="text/css">
<!--
a { color: <%=Application[Session["Style"].ToString()+"xtree_bgcolor"]%>; text-decoration: none}
a:hover { color:red;text-decoration: none}
-->
</style>
    <meta name="CODE_LANGUAGE" Content="C#">
    <meta name=vs_defaultClientScript content="JavaScript">
  </head>
  <body bgcolor='<%=Application[Session["Style"].ToString()+"xspliter_color"]%>' leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onMouseOver="if(parent.middleset.cols='0,*'){parent.middleset.cols='<%=Application[Session["Style"].ToString()+"xleft_width"]%>,*'}" onClick="if(parent.middleset.cols!='0,*'){parent.middleset.cols='0,*'}else{parent.middleset.cols='<%=Application[Session["Style"].ToString()+"xleft_width"]%>,*'};" style="cursor: hand">

    <form id="Form1" method="post" runat="server">
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
</p>
<br/>
<table width="5" height="70" border="0" cellpadding="0" cellspacing="0" bgcolor='<%=Application[Session["Style"].ToString()+"xspliter_color"]%>'>
<tr>
<td height="2" bgcolor='<%=Application[Session["Style"].ToString()+"xtree_bgcolor"]%>'></td>
</tr>
<tr>
<td><font color='<%=Application[Session["Style"].ToString()+"xtree_bgcolor"]%>'>]</font></td>
</tr>
<tr>
<td height="2" bgcolor='<%=Application[Session["Style"].ToString()+"xtree_bgcolor"]%>'></td>
</tr>
</table>
     </form>

  </body>
</html>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的实现评论区折叠功能的 JSP 代码示例: ```jsp <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>评论区</title> <style> .comment { border: 1px solid #ccc; margin: 10px; padding: 10px; } .comment .content { margin-bottom: 10px; } .comment .reply { margin-left: 20px; display: none; } .comment .show-reply { cursor: pointer; color: blue; } </style> </head> <body> <h1>评论区</h1> <% // 模拟从数据库查询评论数据,并将结果存入 comments 变量 List<Comment> comments = new ArrayList<>(); comments.add(new Comment(1, "张三", "这篇文章很好!", new ArrayList<>())); comments.add(new Comment(2, "李四", "我也觉得不错。", new ArrayList<>())); comments.add(new Comment(3, "王五", "我有一些疑问,希望能得到解答。", new ArrayList<>())); comments.get(0).getReplies().add(new Comment(4, "赵六", "同感!", new ArrayList<>())); comments.get(0).getReplies().add(new Comment(5, "钱七", "顶一个!", new ArrayList<>())); %> <% // 遍历评论列表,生成 HTML 代码 for (Comment comment : comments) { %> <div class="comment"> <div class="content"> <strong><%= comment.getAuthor() %></strong>:<%= comment.getContent() %> </div> <%-- 折叠回复列表的按钮 --%> <% if (!comment.getReplies().isEmpty()) { %> <div class="show-reply" onclick="toggleReply(this)">查看回复(<%= comment.getReplies().size() %>)</div> <% } %> <%-- 回复列表 --%> <div class="reply"> <%-- 遍历回复列表,生成 HTML 代码 --%> <% for (Comment reply : comment.getReplies()) { %> <div class="content"> <strong><%= reply.getAuthor() %></strong>:<%= reply.getContent() %> </div> <% } %> </div> </div> <% } %> <script> function toggleReply(button) { var replyDiv = button.parentNode.querySelector('.reply'); if (replyDiv.style.display === 'none') { replyDiv.style.display = 'block'; button.innerText = '收起回复'; } else { replyDiv.style.display = 'none'; button.innerText = '查看回复(' + replyDiv.children.length + ')'; } } </script> </body> </html> ``` 在这个示例,我们使用了一个名为 `Comment` 的类来表示一个评论,其包含了评论的作者、内容以及回复列表。在 JSP 页面,我们模拟了从数据库查询到的评论数据,并通过遍历评论列表生成了 HTML 代码。对于每个评论,我们添加了一个“查看回复”的按钮,点击后可以折叠或展开回复列表。在 JavaScript ,我们定义了一个 `toggleReply` 函数来实现这个功能,它会根据回复列表的显示状态来切换按钮的文本和回复列表的显示状态。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值