Here's the problem I face: I've created a menu and I want when a child li element is clicked a class to be added to the parent li element.

These are the parts of my code that they are relevant to the above:

```
<head>
<script type="text/javascript">
    function changeClass (elementID, newClass) {
        var element = document.getElementById(elementID);

        element.setAttribute("class", newClass); //For Most Browsers
        element.setAttribute("className", newClass); //For IE; harmless to other browsers.
     }
</script>
</head>

<body>
     <li id="galleries" class="galleries">
     <a class="sf-with-ul" href="#">Galleries<span class="sf-sub-indicator"> &#187;</span></a>
     <ul>

         <li>
             <a href="timetest.php?action=add_gallery"onClick="changeClass('galleries',current)">Add Gallery</a>
         </li>
         <li><a href="timetest.php?action=edit_gallery">Edit Gallery</a></li>
     </ul>
         </li>
</body>

```

current is the class that i want to be added at the element with the `id=galleries`.

Please help me if you have an idea why this doesn't work.
The rest code of my page is written in PHP if this has any role to play.