动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
  
   PHP → 阅读文章

 可折叠大纲javascript脚本

作者来源: 
阅读 数 207 人次 , 2006-3-29 4:08:00 


<!--
// outline.js
// see kb article about changing this dynamic html
function getcontroltag(src)
{
trok = false
while ("html" != src.tagname)
{
if ("img" == src.tagname || "font" == src.tagname || "a" == src.tagname || "td" == src.tagname)
trok = true
if ("li" == src.tagname)
return src
if ("tr" == src.tagname)
{
if(trok)
return src
return null
}
src = src.parentelement
}
return null
}
function dynoutlineenabled(src)
{
while ("body" != src.tagname)
{
table = "table" == src.tagname;
if(table && src.getattribute("border", false) != "0")
return false;
if("ol" == src.tagname || "ul" == src.tagname || table)
{
if(null != src.getattribute("nodynamicoutline", false))
return false
if(null != src.getattribute("dynamicoutline", false))
return true
if(mac > 0)
{
var at = src.outerhtml.indexof("dynamicoutline")
if(at > 0)
{
var gt = src.outerhtml.indexof(">")
if(at < gt)
return true
}
}
}
src = src.parentelement
}
return false
}
function initcollapse(src)
{
while ("body" != src.tagname)
{
table = "table" == src.tagname;
if(table && src.getattribute("border", false) != "0")
return false;
if("ol" == src.tagname || "ul" == src.tagname || table)
{
if(null != src.getattribute("initcollapsed", false))
return true
}
src = src.parentelement
}
return false
}
function containedin(src, dest)
{
if ("!" == src.tagname)
return true
src = getcontroltag(src)
if (src == dest)
return true
return false
}
function initoutline()
{
var ms = navigator.appversion.indexof("msie");
mac = navigator.appversion.indexof("macintosh");
ie4 = (ms>0) && (parseint(navigator.appversion.substring(ms+5, ms+6)) >= 4);
if(!ie4)
return;
listtags = new array()
listtags[0]="ul"
listtags[1]="ol"
listtags[2]="table"
for(j=0;j<listtags.length;j++)
{
tagname=listtags[j]
coll=document.all.tags(tagname)
for(i=0; i<coll.length; i++)
{
if(dynoutlineenabled(coll[i].parentelement))
{
if(initcollapse(coll[i]))
coll[i].style.display="none"
}
}
}
}  
function dynoutline()
{
var ms = navigator.appversion.indexof("msie");
ie4 = (ms>0) && (parseint(navigator.appversion.substring(ms+5, ms+6)) >= 4);
if(!ie4)
return;
var src = event.srcelement
src = getcontroltag(src)
if (null == src)
return
if (!dynoutlineenabled(src))
return
var idx = src.sourceindex+1
while (idx < document.all.length && containedin(document.all[idx], src))
{
srctmp = document.all[idx]
tag = srctmp.tagname
if ("ul" == tag || "ol" == tag || "table" == tag)
srctmp.style.display = srctmp.style.display == "none" ? "" : "none"
idx++;
}
}
//-->

 本文Tags组网  
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:可折叠大纲测试例
· 下一篇:xzn_html_tree(1.0) 可折叠大纲
· PHP中如何Header出状态代码
· php+mysql扎实个人基本功
· PHP中实现大图自动缩成小图(及GD库的安装)
· 如何屏蔽掉 phpinfo() 函数
· 让你的PHP4和PHP5共存


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077