Thanks, it works. But in the end is like passing the Id of the element
and then make a getElementByID... is not what i was expecting :( It
looked more clean as it was before but was working only with
Firefox... but nevermind.
Ciao
On Feb 6, 3:57 pm, "Nikodim Lazarov" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Try using the $ method in the expand:
>
> this.activeElement = $(thisItem);
>
> --
> Niko
>
> 2008/2/6, Abba <[EMAIL PROTECTED]>:
>
>
>
> > Hi all, I have setup a small class to manage my menu:
>
> > Event.observe(window, 'load', init, false);
> > var myMenu;
>
> > function init() {
> > myMenu = new Menu;
> > }
>
> > var Menu = Class.create({
> > initialize: function() {
> > this.activeElement = null;
> > this.activeElementChild = null;
> > },
> > expand: function(id, thisItem) {
> > this.hideAll();
> > this.activeElement = thisItem;
> > this.activeElementChild = $(id.toString());
>
> > this.activeElement.addClassName('active');
> > this.activeElementChild.show();
> > },
> > hideAll: function () {
> > if (this.activeElement != null) {
> > this.activeElementChild.hide();
> > this.activeElement.removeClassName('active');
> > }
> > $$('#menuNavigation a.active').each( function(item){
> > item.removeClassName('active');
> > });
>
> > try
> > {
> > $('staticThirdLevel').hide();
> > }
> > catch(err){}
>
> > }
> > })
>
> > I've setup the menu item like this:
>
> > <a onclick="myMenu.expand(1, this)">Users</a>
> > <a onclick="myMenu.expand(2, this)">Dogs</a>
> > ..... etc, etc.....
>
> > The problem is that when it arravies to this line:
>
> > this.activeElement.addClassName('active');
>
> > only in IE (i.e. in Firefox is working) i got the following error:
>
> > Object does not support this property or method
>
> > any idea? Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---