Expanding drop down menu

I’m working on a website that will have a left-hand navigation showing the major departments of the site. When a visitor clicks on a department link, it will show that link and a sub-menu of pages below it.

In other words, they’d initially see:

Department A
Department B
Department C

Then, let’s say they click on the Department A link. Then they’d see:

Department A
Page 1
Page 2
Page 3
Department B
Department C

I’m told that this is done with HTML with if/else statements added to show the sub-menus.

I haven’t worked with if/else statements for a while, and was wondering if you’d mind refreshing my memory on how to implement them.

Normally you’d do that with JavaScript. Here are two online examples by Stu Nichols:


Stu has all sorts of menus on show, such as: