Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

Expand multiple links

I have a list of items on a web page that that is shown as a hyperlink, the example I have below shows one item, when I click on it the notes of that one will be shown, then clicking it again will hide the notes.

What I need to do is to add to this so that I have a list of items rather than just the one example I have, so need to have such as:
    link one
    link two
    link three
    link four
and so on

Can anyone show me how to add more items to my list to the example below.

<html>

<head>
    <title>Test Collapsible link</title>
    <style>
        div#expand {
            display: none;
        }
    </style>
    <script>
        function show() {
            if (document.getElementById('expand').style.display == 'block')
                document.getElementById('expand').style.display = 'none';
            else
                document.getElementById('expand').style.display = 'block';
        }
    </script>
</head>

<body>
    <a href="javascript:;" onclick=show()>Link one</a>
    <div id="expand">
        <p>THis is notes and description for link one</p>
    </div>

</body>

</html>

Open in new window

SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

Thanks to both of you, this is new for me so just starting to learn some basic stuff for now, much appricated.