View Full Version : Help with js Table hiding

04-20-2005, 02:16 PM

Im making a website with lots of forms and am not great with java.
i know there is a way to hide feilds on the form which can be
viewed when a button is pressed
(seen here:http://europass.cedefop.eu.int/instruments/cv/step0.do) all you need to do is click the "START NOW" button and you are presented with the form which has the hidden feilds.
if you press the light bulb or the question mark it will show hidden feilds.
i think this is a great idea and would love to be able to emulate this on
my site.
any help would be greatly appreciated.



04-20-2005, 04:58 PM
Hi Dan,

Have just done a similar thing with drop down menus using a javascript function and CSS custom classes in the <TABLE> tag. When you click on a menu header, the sub menu appears below. Click again and it dissapears.

, the code is shown below.

1. Place this between the <SCRIPT></SCRIPT> tags in the HEAD of the page:

function toggleMenu(currMenu) {
if (document.getElementById) {
thisMenu = document.getElementById(currMenu).style
if (thisMenu.display=="block") {
else {

return false
else {
return true

2. Create CSS classes for your tables and include the disply attribute set to none. This will initialy set your tables to be hidden. apply the class to your trigger element and give that element an ID.

3. Surround your event trigger element (in my case a <TR> tag) with an anchor like so:

<a href="#" onClick="return toggleMenu('menuname)">

where menuname is the ID of the trigger element.

4. One click will show the element, another click will hide it again.

04-20-2005, 05:11 PM
Thanks alot :)

09-15-2005, 12:24 AM
Can I ask what you mean by trigger element, i.e. <a href="#">click here to appear</a>

I dont understand, sorry