Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

need an HTML table of contents which can be turned on or off by the user

I'd like a table of contents and considered using an entire pane on one side, but it took up to much room.

Any suggestions about how to keep the functionality of a table of contents but have it be an option to the user?

thanks,
newbieweb
Avatar of sundaramkumar
sundaramkumar

add a style to the table of contents div/ table

as <div id="toc" style="display:none">
....
....
...

</div>

Now add a button/small image for table of contents
<img src="yourimage" onclick="showToc()">

add javascript fn

function showToc()
{
 if(document.getElementById('toc').style.display=='none')
  document.getElementById('toc').style.display='block';
 else
  document.getElementById('toc').style.display='none'
}
So whenever the image is clicked the toc will shown if it is hidden. if the image is clicked again the toc will hide.

ASKER CERTIFIED SOLUTION
Avatar of sundaramkumar
sundaramkumar

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