A. html 折叠菜单
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td scope="row"><table border="1">
<tr>
<td id="showbfq" height="20" align="top" onclick="if(bfq.style.display=='none'){bfq.style.display='';showbfq.innerText='优质';}
else{bfq.style.display='none';showbfq.innerText='点击更多';}">点击更多</td>
</tr>
<tr>
<td height="80" align="center" name="bfq" id="bfq" style="display:none;">aaa</td>
</tr>
</table></td></tr>
<tr><td><table border="1">
<tr>
<td id="showbfq1" height="20" align="top" onclick="if(bfq1.style.display=='none'){bfq1.style.display='';showbfq1.innerText='优质';}
else{bfq1.style.display='none';showbfq1.innerText='点击更多';}">点击更多</td>
</tr>
<tr>
<td height="80" align="center" name="bfq1" id="bfq1" style="display:none;">bbb</td>
</tr>
</table></td></tr>
<tr><td><table border="1">
<tr>
<td id="showbfq2" height="20" align="top" onclick="if(bfq2.style.display=='none'){bfq2.style.display='';showbfq2.innerText='优质';}
else{bfq2.style.display='none';showbfq2.innerText='点击更多';}">点击更多</td>
</tr>
<tr>
<td height="80" align="center" name="bfq2" id="bfq2" style="display:none;">ccc</td>
</tr>
</table></td></tr>
</table>
一样的,用一个大表格,把它们竖向的框起来。
B. 关于C#折叠式的导航菜单
N个BUTTON.N个PANEL.
每个BUTTON对应一个PANEL.
在BUTTON事件里.让该BUTTON对应的PANEL的Visible=true;
其它的PANEL的Visible=false;
而将要显示的PANEL位置是根据该BUTTON的位置而定的.代码如下:
int top=this.button1.Top-this.button1.Height;
int left=this.button1.Left;
this.panel1.Top=top;
this.panel1.Left=left;
this.panel1.Visible=true;
剩下的BUTTON怎么做.不用我说了吧.
另外要注意的是.在显示PANEL的时候先去判断该PANEL当前的状态.如果已显示就不执行下面代码了.
当PANEL显示时.其下面的BUTTON位置也要变.代码:
this.button2.Top=this.button2.Top+this.panel1.Height;
还有就是关于滑动的效果.要不要都无所谓.如果非要滑动的话.用线程.每隔一小段时间.让PANEL和其它BUTTON的位置向算好的数据靠拢.
C. java如何编写折叠式菜单
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.MutableTreeNode;
public class MainClass extends JPanel {
public static void main(String[] args) {
MutableTreeNode root = new DefaultMutableTreeNode("QQ好友");
MutableTreeNode aNode = new DefaultMutableTreeNode("我的好友");
MutableTreeNode bNode = new DefaultMutableTreeNode("陌生人");
MutableTreeNode cNode = new DefaultMutableTreeNode("黑名单");
root.insert(aNode, 0);
root.insert(bNode, 1);
root.insert(cNode, 2);
aNode.insert(new DefaultMutableTreeNode("friend_a"), 0);
aNode.insert(new DefaultMutableTreeNode("friend_b"), 1);
bNode.insert(new DefaultMutableTreeNode("stranger_a"), 0);
bNode.insert(new DefaultMutableTreeNode("stranger_b"), 1);
cNode.insert(new DefaultMutableTreeNode("black_a"), 0);
cNode.insert(new DefaultMutableTreeNode("black_b"), 1);
DefaultTreeModel model = new DefaultTreeModel(root);
JTree tree = new JTree(model);
JFrame frame = new JFrame("QQ");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JScrollPane(tree),BorderLayout.NORTH);
frame.pack();
frame.setVisible(true);
}
}
D. html折叠菜单
不太理解你要什么,看看下面这段代码实现的效果是你想要的吗?
<style>div{font-size:12px;color:red; background-color: #EAEAE8; border: 1 solid #1892B5; padding: 1}</style>
<div id="main1" style="color:blue" onclick="document.all.child1.style.display=(document.all.child1.style.display =='none')?'':'none'" >
+ 主目录</div>
<div id="child1" style="display:none">
<a href="#">- 子目录1</a> <br>
<a href="#">- 子目录2</a> <br>
<a href="#">- 子目录3</a> <br>
<a href="#">- 子目录4</a>
</div>
<div id="main2" style="color:blue" onclick="document.all.child2.style.display=(document.all.child2.style.display =='none')?'':'none'" >
+ 主目录2 </div>
<div id="child2" style="display:none">
<a href="#">- 子目录1</a> <br>
<a href="#">- 子目录2</a> <br>
<a href="#">- 子目录3</a>
</div>
E. 求一个 HTML的竖向折叠菜单 源码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>竖向的折叠菜单</title>
<script language = JavaScript>
function showmenu(id) {
var list = document.getElementById("list"+id);
var menu = document.getElementById("menu"+id)
if (list.style.display=="none") {
.getElementById("list"+id).style.display="block";
menu.className = "title1";
}else {
document.getElementById("list"+id).style.display="none";
menu.className = "title";
}
}
</script>
<style type="text/css">
<!--
*{margin:0;padding:0;list-style:none;font-size:14px}
#nav{margin:10px;text-align:center;line-height:25px;width:200px;}
.title{background:#336699;color:#fff;border-bottom:1px solid #fff;cursor:pointer;}
.title1{background:#888;color:#000;border-bottom:1px solid #666;cursor:pointer;}
.content li{color:#336699;background:#ddd;border-bottom:1px solid #fff;}
-->
</style>
</head>
<body>
<div id="nav">
<div class="title" id="menu1" onclick="showmenu('1') ">网站制作</div>
<div id="list1" class="content" style="display:none">
<ul>
<li>div+css</li>
<li>网站设计</li>
<li>网站切图</li>
</ul>
</div>
<div class="title" id="menu2" onclick="showmenu('2')">网页代码</div>
<div id="list2" class="content" style="display:none">
<ul>
<li>菜单导航</li>
<li>层和布局</li>
<li>图片切换</li>
</ul>
</div>
</div>
</body>
</html>
看是你想要的吗?