Hello nwhite,

Thanx for the reply and suggestions.

I have applied some of them and now I have this:
        function clear_link(){
                var unlinked = 0;
                mysplit = window.location.href.split('#')[0];
                a = $('#mydiv').getElements('a');
                for(var i=0;i<a.length;i++)
                        if(a[i].href == mysplit){
                                a[i].destroy(); // instead of removeNode(a[i]);
                                var unlinked = 1;
                                }                               
                        if (unlinked == 0){
                                var newHit = a[0];
                                
newHit.parentNode.setProperty('id','active_nav');
                        }
        }

But I am receiving the following error, any thoughts?
$("#mydiv") is null
[Break on this error] a = $('#mydiv').getElements('a');


On Feb 10, 2009, at 7:20 PM, nwhite wrote:

I think your problem is in this line: newHit.parentNode.setProperty ('id','active_nav');

while this line could work if newHit's parentNode has already been extended by mootools. If it hasn't this code breaks. you should use the mootools 'getParent()' instead.

new.getParent().setProperty(...);

this makes sure that the parent is extended.

also you should consider using a[i].destroy() instead of removeNode(a[i]);

An optimization tip... For every single link in the document your spliting window.location.href you should do this once and store it in a var above your for loop.

Reply via email to