JavaScript nodetree navigation Bar (menu item JSON type/homemade) _javascript tips

Source: Internet
Author: User
Recently more leisurely, I made a JavaScript nodetree, online similar things in fact quite a lot of functions than this whole, I do this purely to practice practicing.

Icons can be customized (16X16), and menu items are entirely JSON-type-defined for easy modification.
Interface

How to use
1, copy the Nodetree-json.js and CSS folders into the project and reference.
2. Refer to the jquery framework.
3, modify the Nodetree-json.js in the Nodetreemenu menu items, the following is a simple description.
Copy Code code as follows:

var nodetreemenu = [
ID: node Id,pid: parent Node ID, no parent node is 0,name: Display Name, img: Display icon, open: Only the parent node has this property, the child node is expanded by default, file: Only child nodes by this property, click on the Open page
{id:1, pid:0, Name: "Parent node One", img: "Css/images/001.png", open:true},
{id:101, pid:1, Name: "Child node One", img: "Css/images/002.png", File: "http://www.cnblogs.com/nnzfly/"}//note that the end of the last row of data must not add commas! Otherwise IE under the error!
]

4, add the following code where you want to display Nodetree:
Copy Code code as follows:

<ul id= "Nodetree-json" >
</ul>

5. Add the following code to the page:
Copy Code code as follows:

<script type= "Text/javascript" >
$ (function () {
Nodetree ("MainFrame");
});
</script> or (whichever is optional):
<script type= "Text/javascript" >
Window.onload=function () {
Nodetree ("MainFrame");
}
</script>


Nodetree ("MainFrame"), MainFrame is the name of the target frame, such as the navigation bar in the left frame, and the Name= "MainFrame" of the frame displayed on the right.
Really do not understand look at the demo.htm code, you understand.
Attached source code, interested can see ~
Http://dl.vmall.com/c0b7wda1ps
Please click on the recommendation, 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.