Java Menu

Hello

I have this javascript menu, using css and javascript, but i have a small thing im not sure of, i have the menu to open when u click it and then close and open another menu when the other one is clicked.

but i want the menu to open when u click on it and then close when u click on it again.

This is my code:

function initMenu() {
  $('#menu ul').hide();
  //$('#menu ul:first').show();
  $('#menu li a').click(a
    function() {		
      var checkElement = $(this).next();
	  //checkElement.slideToggle('normal');
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('#menu ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
$(document).ready(function() {initMenu();});

Regarding the title of your thread:

JavaScript is not the same as Java

i want the menu to open when u click on it and then close when u click on it again.

It sounds like you want the toggle() method.

Where I can i add the toggle() function in the current code, and have the buttons of the menu still open when clicked and when another button on the menu is clicked that one opens and the previous one closes?

cause i got the toggle thing working, but then when you click another menu button the previous one stays open.