/    Sign up×
Community /Pin to ProfileBookmark

Dropdown links (collapse)

Hi, this is my first time here in webdeveloper. I am also a newbie in javascript.

Here’s my problem.

I need a script that functions like a collapse menu.

Example:

Main Link
– Sub link 1
– Sub link 2

If i click the main link it will display the sub links.

I’ve already done this and it looks ok, until there is a suggestion that it would be better if the user after clicking on the sub link and being redirected to the page, when he click the back button on the browser, he wouls still see the sub links, so he will not click on the main link again.

My script is so simple, it doesnt contain any images or buttons, plain text and links.

Is this possible? Please suggest your ideas, thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoFeb 28.2006 — 
  • 1. Open the new window in a popup, or in the worse case scenario, an IFrame.


  • or

  • 2. Use a cookie to remember which menu was opened.


  • Once a page is redirected in the same window, and then you reload the page, all of the data from that page will be not be saved, unless you use a cookie to remember it.
    Copy linkTweet thisAlerts:
    @drachoauthorMar 01.2006 — Thanks for the reply. I dont know how to use cookies. can you give me just a short example?

    thanks again
    Copy linkTweet thisAlerts:
    @LeeUMar 01.2006 — Are you looking for something like [URL=http://javascript.internet.com/navigation/expanding-menu.html]this[/URL] ?
    Copy linkTweet thisAlerts:
    @drachoauthorMar 02.2006 — yes, something like it. but it doesnt remember what you clicked last. If you click the back button all the menu will not display the last clicked menu.
    ×

    Success!

    Help @dracho spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.27,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...