网页特效之HTML中树的实现方法
日期:2007年8月25日 作者: 查看:[大字体 中字体 小字体]-
利用Javascirpt我们可以很容易的在Html中实现树,而不需要使用ASP,jsp,PHP等等编写动态程序,当然如果要和数据库结合,下面的代码也很容易移植。
首先,我们看一下实现这个树形结构的javascript代码。
common.js
<!--
function showCurrentSection()
{
var objCurrentSection = document.getElementById("navcurrentsection");
if (objCurrentSection != null)
{
objCurrentSection.style.display = "block";
objCurrentSection.parentElement.childNodes[0].className = "open";
if (objCurrentSection.parentElement.parentElement.nodeName == "UL")
showSection(objCurrentSection.parentElement.parentElement);
}
}
function showSection(objSection)
{
objSection.style.display = "block";
objSection.parentElement.childNodes[0].className = "open";
if (objSection.parentElement.parentElement != null && objSection.parentElement.parentElement.nodeName == "UL")
showSection(objSection.parentElement.parentElement);
}
-->下面是实现树的静态HTML文件,很简单的啊。
example1.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" xml:lang="en" lang="en">
<head>
<title>Current Tree Node Opener</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- [1] [2] [3] 下一页
- 网页特效之HTML中树的实现方法 相关文章:
- ·网页特效之HTML中树的实现方法
- 网页特效之HTML中树的实现方法 相关软件
- 特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作
- 者.文章版权归文章原始作者所有.对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转
- 载的文章有版权问题请联系编辑人员,我们尽快予以更正. 转载请注明来源:http://www.hackhome.com
精品推荐
热点TOP10
- ·对联广告代码效果大全
- ·网页对联广告代码效果大全
- ·JavaScript方法和技巧大全
- ·网页两侧浮动广告代码
- ·对联广告JS代码效果大全
- ·Ajax实现无刷新树
- ·一些很实用且必用的小脚本代码
- ·鼠标自动移动/点击
- ·ajax进度条
- ·JavaScript仿Windows关机效果
- ·一个以Javascript+xml的树型列表
- ·打开网页自动设为首页代码
- ·B/S开发常用JavaScript技术
- ·javascript 常用代码大全
- ·JS代码的格式化和压缩
- ·设置首页和添加到收藏夹代码大全
- ·适合本blog的一个精美javascript日历
- ·JavaScript经典效果集锦
- ·网页特效之HTML中树的实现方法
- ·网页的DOCTYPE HTML public 会导致页面的部分事件不触发
特别推荐
