有谁做过JS记录收起和展开的功能,请指教下
有谁做过JS记录收起和展开的功能,请指教下我想点击展开,再点击缩回
因为有多个页面,所以在点一次后可以记录,请高手指教 那个传说中的子虚乌有怎么不见了
好怀念啊 可以判断他的高度来升缩,也可以通过判断他的display [quote]原帖由 [i]kabukon[/i] 于 2008-5-8 12:21 发表 [url=http://bbs.blueidea.com/redirect.php?goto=findpost&pid=3990880&ptid=2853279][img]http://bbs.blueidea.com/images/common/back.gif[/img][/url]
可以判断他的高度来升缩,也可以通过判断他的display [/quote]
多谢这位神秘的高手
升缩都做好了,现在是要记录升缩状态,以便下一个页面使用同样的状态,该怎么办?
啊,发现这里的JS牛人真多啊 三个方法
1. 通过COOKIES
2.通过HASH
3.通过WIN.NAME
也可能我只知道这三个方法 还有其他方法吧 [quote]原帖由 [i]foxbaty[/i] 于 2008-5-8 13:47 发表 [url=http://bbs.blueidea.com/redirect.php?goto=findpost&pid=3991089&ptid=2853279][img]http://bbs.blueidea.com/images/common/back.gif[/img][/url]
三个方法
1. 通过COOKIES
2.通过HASH
3.通过WIN.NAME
也可能我只知道这三个方法 还有其他方法吧 [/quote]
2.通过HASH
3.通过WIN.NAME
第一种明白,后两个好象没听说过啊,又一个高手出现了啊 [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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
body{font-size:12px}
h2{margin:0;width:120px; height:22px; background:#DADADA; line-height:22px; font-size:14px; padding-left:12px; padding-right:12px; border-bottom:1px solid #fff}
div{margin:0; padding:12px; width:120px; background:#EAEAEA}
</style>
<script type="text/javascript">
function tab() {
var tabs = document.getElementsByTagName("H2");
var boxs = document.getElementsByTagName("DIV");
var sId = readCookie("sId");
if (sId == "" || sId == "null") sId = null;
for (var i=0; i<tabs.length; i++) {
if ( i != sId ) boxs[i].style.display = "none";
setClick(i);
}
function setClick(num) {
tabs[i].onclick = function() {
if (sId != num ) {
if (typeof sId != "undefined" && sId != null) boxs[sId].style.display = "none";
sId = num;
boxs[sId].style.display = "block";
} else {
boxs[sId].style.display = "none";
sId = null;
}
writeCookie("sId", sId);
}
}
}
function readCookie(l){
var i="",I=l+"=";
if(document.cookie.length>0){
offset=document.cookie.indexOf(I);
if(offset!=-1){
offset+=I.length;
end=document.cookie.indexOf(";",offset);
if(end==-1)end=document.cookie.length;
i=unescape(document.cookie.substring(offset,end))
}
}
return i;
}
function writeCookie(O,o){
document.cookie=O+"="+escape(o);
}
window.onload = tab;
</script>
</head>
<body>
<h2>菜单1</h2>
<div>菜单1内容</div>
<h2>菜单2</h2>
<div>菜单2内容</div>
<h2>菜单3</h2>
<div>菜单3内容</div>
</body>
</html>
[/html] LZ拿到现成代码就不回复,此人。。。:o [url]http://www.qqdang.net/code/windowsMenu/[/url]
右键->源代码 我怎么定位呀
我想把他放到一个容器中。放进去就不会显示了
页:
[1]