If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

change the page content by clicking on menu option

Hi!
My question: how to change the page content by clicking on menu option (without opening a new page) with javascript.
I have written HTML and CSS code (menu), but i don't know how to start writing javascript code.
Need just a little guidance.

Thank you for your help!
Can you explain (function toggle (IDS) {………}) // how does it work, I am not good in JavaScript.
I posted this question to a FORUM and somebody answered that” you can also solve the problem with Js event listeners”
If it is possible please explain also how I can solve this problem with JS event listeners.

Thank you for your help!
Can you explain (function toggle (IDS) {………}) // how does it work, I am not good in JavaScript.
I posted this question to a FORUM and somebody answered that” you can also solve the problem with Js event listeners”
If it is possible please explain also how I can solve this problem with JS event listeners.

Peter

You're most welcome.
Happy to help.

The toggle function just collects all the <div> elements within the 'pg' element.
It resets all displays to 'none', except the currently referenced IDS.
If the id value matches the current status, it changes (toggles) between 2 different states (display:block or display:none)

The event listener in this particular case is the 'onclick=' event
which occurs when you click on the mouse.