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.
On Tue, Feb 10, 2009 at 7:53 AM, Daiv Mowbray <[email protected]>wrote:
>
>
>
> Hello List,
>
> I have a little menu script and One of the functions is to remove
> the link from the active page.
>
> Try as I might I am receiving the following error, which I was hoping
> someone
> might be able to explain to me. Thanx.
>
> error: L is null in mootools...ver=1.2.1 (line 134)
>
> }},after:function(M,L){if(!L.parentNode)...},bottom:function(M,L){L.appendChild(M);
>
> my Function:
> function clear_link(){
> var unlinked = 0;
> a = document.getElements('a');
> for(var i=0;i<a.length;i++)
> if(a[i].href == window.location.href.split('#')[0]){
> removeNode(a[i]);
> var unlinked = 1;
> }
> if (unlinked == 0){
> var newHit = a[0];
> newHit.parentNode.setProperty
> ('id','active_nav');
> }
> }
> ----------
> Daiv Mowbray
> [email protected]
> ----------
>
>
>