这断代码如何改成默认为关闭的而不是展开的
来源:互联网 发布:java 注解开发 编辑:程序博客网 时间:2024/06/15 18:56
请问如何将这断代码改成默认为关闭的而不是展开的???
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>runcode</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript">
var mh = 30;//最小高度
var step = 5;//每次变化的px量
var ms = 10;//每隔多久循环一次
function toggle(o){
if (!o.tid)o.tid = "_" + Math.random() * 100;
if (!window.toggler)window.toggler = {};
if (!window.toggler[o.tid]){
window.toggler[o.tid]={
obj:o,
maxHeight:o.offsetHeight,
minHeight:mh,
timer:null,
action:1
};
}
o.style.height = o.offsetHeight + "px";
if (window.toggler[o.tid].timer)clearTimeout(window.toggler[o.tid].timer);
window.toggler[o.tid].action *= -1;
window.toggler[o.tid].timer = setTimeout("anim('"+o.tid+"')",ms );
}
function anim(id){
var t = window.toggler[id];
var o = window.toggler[id].obj;
if (t.action < 0){
if (o.offsetHeight <= t.minHeight){
clearTimeout(t.timer);
return;
}
}
else{
if (o.offsetHeight >= t.maxHeight){
clearTimeout(t.timer);
return;
}
}
o.style.height = (parseInt(o.style.height, 10) + t.action * step) + "px";
window.toggler[id].timer = setTimeout("anim('"+id+"')",ms );
}
</script>
<style type="text/css">
div.xx{border:solid 1px;overflow:hidden;}
div.xx h5{border:solid 1px;border-width:0 0 1px;padding:0;margin:0;height:30px;line-height:30px;cursor:pointer;background:#E7F5F8;}
</style>
</head>
<body>
<div class="xx"><h5 onclick="toggle(this.parentNode)">点击我看"伸缩效果"</h5>
<table><tr><td>
<p>中国站长站</p>
<p>站长素材站</p>
<p>站长脚本站</p>
<p>站长下载</p>
</td></tr></table>
</div>
</body>
</html>
- 这断代码如何改成默认为关闭的而不是展开的
- treeview的某个节点默认为展开
- eclipse默认编码为Cp1252改成GBK的方法
- 如何将QuickStart的默认语言改成C#
- 如何将QuickStart的默认语言改成C#
- Android之背景图片设置为重复而不是默认的拉伸
- html的默认提交方式为get而不是post
- [Android]expandablelistview默认展开以及记录已展开或关闭的子布局
- 如何关闭win2000,winxp默认的共享
- 如何彻底关闭WIN2003的默认共享
- cmder默认的命令提示符λ改成$
- 默认的命令提示符 λ 改成 $
- Cmder默认的命令提示符 λ 改成 $
- 树状菜单 点击一个关闭另一个 默认第一个栏目的子栏目展开
- Ext.ux.grid.RowExpander 如何设置为默认展开效果
- 如何将maven的默认JRE1.5改成1.7修改方法
- 艰难前行的故事 (《梦断代码》读后感)
- 深入灵魂的共鸣 (《梦断代码》读后感)
- ORACLE和POSTGRESQL的SQL语句比较
- ASP.NET中GridView分页
- 动态规划算法备忘
- sizeof运算符计算数组长度
- 网络中的端口收集【供自己备忘,同时也能给别人提供点点方便】
- 这断代码如何改成默认为关闭的而不是展开的
- FLEX实践—弹出窗口、滚动字幕
- 理解Javascript闭包(closure)
- sp_block查看数据库进程状态(是否阻塞,执行SQL等),可替代sp_who
- IMPORT EXPORT
- Visual Studio 2010 Beta 2软件界面
- 一无所有时,靠什么成功?
- 智能视频分析技术与被动红外技术的整合应用
- 配置oracle10g oem中的主机身份证明的方法