Html中使用M$控件系列之 TreeView 篇

发表于:2007-06-30来源:作者:点击数: 标签:
TreeView控件需要一个ImageList控件支持,结构比较复杂,个人认为并不适合在Html中应用。 本文为大家介绍一个变通的方法----HHctrl结合数据源文件实现Tree结构。 本文是Html中的应用,用于 数据库 做动态显示的话之需要实用程序同步数据源文件即可,这个问题
TreeView控件需要一个ImageList控件支持,结构比较复杂,个人认为并不适合在Html中应用。
本文为大家介绍一个变通的方法----HHctrl结合数据源文件实现Tree结构。
本文是Html中的应用,用于数据库做动态显示的话之需要实用程序同步数据源文件即可,这个问题不在本文讨论范围之列。
代码是M$程序的一部分,比较简单,故没什么注释,有什么问题可直接联络我。

CopyRight By Cheery_Ke,All Reserved.

主文件Main.htm

<div style="font-family:宋体;font-size:9pt">
<OBJECT id=hhctrl type="application/x-oleobject"
        classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
        codebase="../../common/i386.cab#version=4,73,8412,0"
        width="262"
        height="74%">
    <PARAM name="Command" value="Contents">
    <PARAM name="flags" value="0x0,0x35,0xFFFFFFFF"><!--显示状态,0x0表示是否3D效果,0x35表示图表形态,0xFFFFFFFF表示背景颜色-->
    <PARAM name="Item1" value="cohhc.hhc"><!--数据源文件地址-->
</OBJECT>
</div>


数据源文件cohhc.hhc

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<OBJECT type="text/site properties">
    <param name="FrameName" value="main">
</OBJECT>
<UL>
    <LI> <OBJECT type="text/sitemap">
        <param name="Name" value="开始">
        <param name="Local" value="/iishelp/iis/htm/core/iiwltop.htm">
        </OBJECT>
    <UL>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="版本发布说明"><!--显示的文字,下同-->
            <param name="Local" value="/iishelp/iis/htm/core/readme.htm"><!--联接的地址,下同-->
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="安装 IIS">
            <param name="Local" value="/iishelp/iis/htm/core/iiiisin.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="特性">
            <param name="Local" value="/iishelp/iis/htm/core/iifeats.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="变化内容">
            <param name="Local" value="/iishelp/iis/htm/core/iibwupm.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="Web 资源">
            <param name="Local" value="/iishelp/iis/htm/core/iiusdoc.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="使用 IIS 快速建立站点">
            <param name="Local" value="/iishelp/iis/htm/core/iitstart.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="使用文档">
            <param name="Local" value="/iishelp/iis/htm/core/iigsdocs.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="常见问题">
            <param name="Local" value="/iishelp/iis/htm/core/iifaq.htm">
            </OBJECT>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="词汇表">
            <param name="Local" value="/iishelp/iis/htm/core/iigloss.htm">
            </OBJECT>
    </UL>
    <LI> <OBJECT type="text/sitemap">
        <param name="Name" value="管理">
        <param name="Local" value="/iishelp/iis/htm/core/iinewtp2.htm">
        </OBJECT>
    <UL>
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="Web 站点管理">
            <param name="Local" value="/iishelp/iis/htm/core/iiwebcon.htm">
            </OBJECT>
        <UL>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="关于 Web 站点管理">
                <param name="Local" value="/iishelp/iis/htm/core/iihtmat.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="选择创作工具">
                <param name="Local" value="/iishelp/iis/htm/core/iihowat.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="使用 ASP 管理 Web 站点内容">
                <param name="Local" value="/iishelp/iis/htm/core/iiaspat.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="更改主目录">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirh.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="创建虚拟目录">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirv.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="将请求重定向到目录">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirr.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="重定向程序请求">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirp.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="启用内容截止日期">
                <param name="Local" value="/iishelp/iis/htm/core/iipswwws.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="使用内容分级">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirc.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="为 Web 页添加页脚">
                <param name="Local" value="/iishelp/iis/htm/core/iicodirf.htm">
                </OBJECT>
            <LI> <OBJECT type="text/sitemap">
                <param name="Name" value="服务器端包含">
                <param name="Local" value="/iishelp/iis/htm/core/iisiwelc.htm">
                </OBJECT>
            <UL>
                <LI> <OBJECT type="text/sitemap">
                    <param name="Name" value="关于服务器端包含">
                    <param name="Local" value="/iishelp/iis/htm/core/iisiabt.htm">
                    </OBJECT>
                <LI> <OBJECT type="text/sitemap">
                    <param name="Name" value="启用服务器端包含">
                    <param name="Local" value="/iishelp/iis/htm/core/iisienab.htm">
                    </OBJECT>
                <LI> <OBJECT type="text/sitemap">
                    <param name="Name" value="使用服务器端包含指令">
                    <param name="Local" value="/iishelp/iis/htm/core/iisincf.htm">
                    </OBJECT>
                <LI> <OBJECT type="text/sitemap">
                    <param name="Name" value="服务器端包含参考">
                    <param name="Local" value="/iishelp/iis/htm/core/iisiref.htm">
                    </OBJECT>
                <UL>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#config">
                        <param name="Local" value="/iishelp/iis/htm/core/iisicfg.htm">
                        </OBJECT>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#echo">
                        <param name="Local" value="/iishelp/iis/htm/core/iisieco.htm">
                        </OBJECT>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#exec">
                        <param name="Local" value="/iishelp/iis/htm/core/iisiexc.htm">
                        </OBJECT>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#flastmod">
                        <param name="Local" value="/iishelp/iis/htm/core/iisiflm.htm">
                        </OBJECT>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#fsize">
                        <param name="Local" value="/iishelp/iis/htm/core/iisifsz.htm">
                        </OBJECT>
                    <LI> <OBJECT type="text/sitemap">
                        <param name="Name" value="#include">
                        <param name="Local" value="/iishelp/iis/htm/core/iisiinc.htm">
                        </OBJECT>
                </UL>
            </UL>
        </UL>
    </UL>
</UL>

题外话:
    有关结合数据库的动态显示,本文提供两种解决方案
    第一种,如上文所介绍的,每次数据库中相关表更新的时候,同步数据源文件cohhc.hhc(其实就是一个文本文件,可以用任何文本编辑器打开),更新的方法很多,FSO之类的,我就不多说了,这种方法是用于结构变化不是很频繁的系统,优点就是纯静态显示,速度、性能好;
    第二种,将数据源文件cohhc.hhc改名为cohhc.asp,这样你就可以象操作普通asp文件一样操作数据源了,包括从数据库读取记录,显示在控件中,见下:

        ......
        <LI> <OBJECT type="text/sitemap">
            <param name="Name" value="Rs(0)"><!--显示的文字,下同--><!--注意,Rs(0)两端一定要有"!!-->
            <param name="Local" value="Rs(1)"><!--联接的地址,下同-->
            </OBJECT>
        ......
    本方法的优点当然就是实时性好,适用于不断更新结构的系统当中。

原文转自:http://www.ltesting.net