How do I get a Tree menu to expand when I navigate from another page?

... also

is it possible to expand on a specific section? (See prev. Post for code and more background)

Member Avatar for iamthwee

By tree menu do you mean something like this

By tree menu do you mean something like this

Yes, but myne is a lot more complicated.

JS File 1:

// Tree structure definition
var TREE_NODES = [
["Module1: Use of Firearms", null, null,
["General Safety and Req of Firearms Control", null, null,
["Learning Outcome", "../General Safety and Req of Firearms Control/Learning Outcome.html", null],
["Introduction", "../General Safety and Req of Firearms Control/FT01_01_01.html", null],
["Safety Considerations", "../General Safety and Req of Firearms Control/FT01_01_02.html", null],
["Summary", "../General Safety and Req of Firearms Control/Summary.html", null]],
["Fundamentals of Shooting", "other.html", null,
["Learning Outcome", "../Fundamentals of Shooting/Learning Outcome.html", null],
["Introduction", "../Fundamentals of Shooting/FT01_02_01.html", null],
["Body Position", "../Fundamentals of Shooting/FT01_02_02.html", null,
["The Interview Position", "../Fundamentals of Shooting/FT01_02_03.html", null],
["The Ready Position", "../Fundamentals of Shooting/FT01_02_06.html", null],
["Kneeling Position", "../Fundamentals of Shooting/FT01_02_08.html", null],
["The Prone Position", "../Fundamentals of Shooting/FT01_02_09.html", null]],
["Firm Controlled Grip", "../Fundamentals of Shooting/FT01_02_10.html", null],
["Correct Sight Picture", "../Fundamentals of Shooting/FT01_02_14.html", null],
["Trigger Squeeze", "../Fundamentals of Shooting/FT01_02_16.html", null],
["Controlled Relaxed Breathing", "../Fundamentals of Shooting/FT01_02_17.html", null],
["Correct Technique for Follow-Through", "../Fundamentals of Shooting/FT01_02_18.html", null],
["Fault Identification on the Shooting Range", "../Fundamentals of Shooting/FT01_02_19.html", null],
["Psychological Preparation", "../Fundamentals of Shooting/FT01_02_20.html", null],
["Summary", "../Fundamentals of Shooting/Summary.html", null]],
["Z88 / Pietro Beretta Pistol", null, null,
["Learning Outcome", "../Pietro Beretta Pistol/Learning Outcome.html", null],
["Introduction", "../Pietro Beretta Pistol/FT01_03_01.html", null],
["Names of Visible Parts (External)", "../Pietro Beretta Pistol/FT01_03_02.html", null],
["Making Safe Procedures", "../Pietro Beretta Pistol/FT01_03_03.html", null],
["Description", "../Pietro Beretta Pistol/FT01_03_04.html", null],
["Characteristics", "../Pietro Beretta Pistol/FT01_03_05.html", null],
["Stripping and Assembling", "../Pietro Beretta Pistol/FT01_03_06.html", null],
["Names of Internal Parts", "../Pietro Beretta Pistol/FT01_03_08.html", null],
["Mechanism", "../Pietro Beretta Pistol/FT01_03_09.html", null],

["Different Carry Conditions", null, null],
["Stoppages (Malfunction)", null, null],
["Immediate Reaction Drill", null, null],
["Cleaning & Maintenance", null, null],
["Magazine Filling", null, null],
["Shooting Range Commands", null, null],
["Summary", null, null]],
["Republic Arm Pistol ", null, null,
["Learning Outcome", null, null],
["Introduction", null, null],
["Visible Parts", null, null],
["Making Safe Procedure", null, null],
["Description", null, null],
["Characteristics", null, null],
["Stripping", null, null],
["Assembling", null, null],
["Names of Internal Parts", null, null],
["Understanding the Mechanism of the RAP 401", null, null],
["Different Carry Conditions", null, null],
["Maintenance", null, null],
["Magazine Filling", null, null],
["Loading and Unloading", null, null],
["Identification of Stoppages/Malfunctions", null, null],
["Immediate Reaction Drills", null, null],
["Shooting Range Commands", null, null],
["Summary", null, null]],
["R5 Assault Rifle ", null, null,
["Learning Outcome", null, null],
["Introduction", null, null],
["Visible Parts", null, null],
["Making Safe Procedure", null, null],
["Description", null, null],
["Characteristics", null, null],
["Stripping and Assembling", null, null],
["Names of Internal Parts", null, null],
["Mechanism", null, null],
["Different Carry Conditions", null, null],
["Maintenance", null, null],
["Magazine Filling", null, null],
["Loading and Unloading of the R5", null, null],
["Identifying Stoppages", null, null],
["Rectification of Malfunctions/Misfires", null, null],
["Shooting Range Drills", null, null],
["Summary", null, null]],
["Musler 12 Gauge Shotgun", null, null,
["Learning Outcome", null, null],
["Introduction", null, null],
["Visible Parts", null, null],
["Making Safe Procedure", null, null],
["Description and Characteristics", null, null],
["Stripping and Assembling the Musler", null, null],
["Maintaining the Musler", null, null],
["Names of Parts", null, null],
["Mechanism", null, null],
["Different Carry Conditions", null, null],
["Magazine Filling", null, null],
["Identification of Stoppages", null, null],
["Rectification of Stoppages", null, null],
["Shooting Range Commands", null, null],
["Summary", null, null]],
["Tactical Shooting Techniques", null, null,
["Learning Outcome", null, null],
["Introduction", null, null],
["Draw and Fire in Condition 2", null, null],
["Single-Hand Firing", null, null],
["Magazine Change", null, null],
["Draw/Turn and Fire in Different Directions", null, null],
["Instinctive Shooting", null, null],
["Shoot in a Ready Position", null, null],
["Shoot from Behind Cover", null, null],
["Technique to Shoot During Low Light Situations", null, null],
["Summary", null, null]],
],
["Module2: Legal Principles", null, null,
["Private Defence", null, null,
["Learning Outcome", "../Fundamentals of Shooting/Objective.html", null],
["Introduction", null, null],
["Grounds of Justification", null, null],
["Definition", null, null]],
["Use of Force in Arrest", "other.html", null,
["Learning Outcome", null, null],
["Introduction", null, null],
["The Object of an Arrest", null, null],
["The Requirements for a Lawful Arrest", null, null],
["Manner of Effecting an Arrest", null, null],
["Physical Execution of an Arrest", null, null],
["The Requirements for the use of Force", null, null]],
["Section 49 - Use of Deadly Force", "../other_folder/file.html", null,
["Learning Outcome", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
["Police Directives - Use of Firearms", "../other_folder2/file.html", null,
["Learning Outcome", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
["Requirements of Firearms Control Act 2000", "../other_folder2/file.html", null,
["Learning Outcome", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
],
["Module3: Obstacle Shooting Course", null, null,
["Introduction", "#sectionName", null,
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
["Activities and Assessment", "other.html", null,
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
],
["Module4: Simulated Exercises", null, null,
["Introduction", "#sectionName", null,
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
["Simulation Excercise", "other.html", null,
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null],
["template", null, null]],
]
];

JS File 2:

// Tree format definition
var TREE_FORMAT = [
// 0. left position
10,
// 1. top position
10,
// 2. show buttons ("+" and "-" images)
true,
// 3. button images: collapsed state, expanded state, blank image
["graphics/collapsed_button.gif", "graphics/expanded_button.gif", "graphics/blank.gif"],
// 4. size of buttons: width, height, indent amount for childless nodes
[16, 16, 16],
// 5. show icons ("folder" and "document")
true,
// 6. icon images: closed folder, opened folder, document
["graphics/closed_folder.gif", "graphics/opened_folder.gif", "graphics/document.gif"],
// 7. size of icons: width, height
[16, 16],
// 8. indent amount for each level of the tree
[0, 16, 32, 48, 64, 80, 96, 112, 128],
// 9. background color for the tree
"",
// 10. default CSS class for nodes
"treeNode",
// 11. individual CSS classes for levels of the tree
[],
// 12. "single branch" mode
false,
// 13. padding and spacing values for all nodes
[0, 0]
];
---------------------------------------------------------------------

Not necessary to post the other file coding.
Note: Am not finished with Links.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.