JavaScript NodeTree navigation bar (menu item JSON type/self-made)

Source: Internet
Author: User

Recently, I was relatively idle. I made a JavaScript NodeTree myself. There are actually a lot of similar things on the internet, and there are more functions than this. I am doing this purely for the trainer.

The icons can be customized (16X16). The menu items are completely JSON-type and easy to modify.
Interface:

Usage:
1. Copy the NodeTree-JSON.js and CSS folder to the project and reference it.
2. Reference The JQuery framework.
3. Modify the NodeTreeMenu menu item in the NodeTree-JSON.js, which is described below.Copy codeThe Code is as follows: var NodeTreeMenu = [
// Id: node ID, pId: parent node Id; 0 if no parent node exists; name: Display name; img: display icon; open: only the parent node has this attribute, whether the child node is expanded by default. file: only the child node has this attribute. The page opens after clicking
{Id: 1, pId: 0, name: "parent node 1", img: "CSS/Images/001.png", open: true },
{Id: 101, pId: 1, name: "subnode 1", img: "CSS/Images/002.png", file: "http://www.cnblogs.com/nnzfly/"} // note that the end of the last line of data must not contain a comma! Otherwise, an error is reported in IE!
]

4. Add the following code where NodeTree is to be displayed:Copy codeThe Code is as follows: <ul id = "NodeTree-JSON">
</Ul>

5. Add the following code to the page:Copy codeThe Code is as follows: <script type = "text/javascript">
$ (Function (){
NodeTree ("mainFrame ");
});
</Script> or (either ):
<Script type = "text/javascript">
Window. onload = function (){
NodeTree ("mainFrame ");
}
</Script>

In NodeTree ("mainFrame"), mainFrame is the name of the target frame. For example, in the frame on the left of the navigation bar, the name of the frame on the right is "mainFrame ".
Let's see the demo.htm code.
The source code is attached. If you are interested, you can check it out ~
Http://dl.vmall.com/c0b7wda1ps
Please click here for recommendations. Your support is my greatest motivation!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.