bianbian coding life

便便代码人生: 关注技术, 翻译文档, 偶尔动动手

[原]Create Tree menu from HHC file automatically (HHC转为树形菜单)

Posted by bianbian on 2006-09-08 02:16

本文Tags: , ,

最近写了自动把HHC代码(HHC是CHM帮助文件过程中的目录结构描述文件)生成树形菜单,方便提供在线帮助手册;否则还得手动编写在线帮助的目录结构。支持IE和Firefox、Opera,其他浏览器未测试。使用也很简单,将下载的文件解压到images目录里,然后将HHC文件后缀改为htm(我们拿dir.htm举例),并添加两行代码既可:

sorry for my poor English: I wrote a script to change a HHC file(providing tree index file structure used by CHM-help-format) to tree menu. It's useful when providing online help after having produced CHM help, or you must produce a index-page manually - it's tedious, right? I tested it under IE 6.0, firefox 1.5, and Opera 0.9. It's also easy to use: you only need unzip it to "images" directory, change *.HHC file to *.HTM(dir.htm e.g.), and add two simple lines:

  1. <link type="text/css" rel="stylesheet" href="images/hhc_tree.css" />
  2. <script src="images/hhc_tree.js"></script>

当然了,你得增加个框架,左边引用dir.htm,右边是其他帮助文件。(我的代码会自动找到宽度最大的框架,并把树形菜单里的链接target指向这个框架,所以不用担心框架的命名问题,只要命名过就可以)。像这样:

sorry again: Certainly, you need add a frame page, dir.htm on left maybe, rightside is main help area. My script will set the links' target of tree menu with the frame's name which has the maximized width. So needn't care about the name of frames-but you must set one. like this:

  1. <html>
  2. <head><title>Online Help</title></head>
  3. <frameset cols="200,600">
  4.   <frame src="dir.htm" name="index">
  5.   <frame src="main.htm" name="main">
  6. </frameset>
  7. <body>
  8. <!--let search-engine work :)-->
  9. Your browser does not support frames: <a href="dir.htm">Index</a> <a href="main.htm">Main</a>
  10. </body>
  11. </html>

没有版权,随意使用,代码内的作者不要删掉就可以。:)

sorry last: Copyleft, as long as the author-line remains unchanged.
download here: HHC to Tree Menu (2.5K)

标签: , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

One Response to “[原]Create Tree menu from HHC file automatically (HHC转为树形菜单)”

  1. 3x a lot Says:

    good job! Thank you

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)