Thanks Karsten, my problem is solved.

On 8/28/07, Karsten Düsterloh <[EMAIL PROTECTED]> wrote:
>
> joe ertaba aber hob zu reden an und schrieb:
> > var target = e.target;
> > while(target.href == undefined)
> > target = target.parentNode;
> >
> > var href = target.href;
> >
> > it works good but it get error at line (while(target.href == undefined))
> > when target is not a link: Error: target has no properties
>
> You need to check that haven't passed the root node yet (whose
> parentNode will be null) and you should use the "in" operator to check
> for the href member instead of comparing against undefined:
>
> var target = e.target;
> while (target && !("href" in target))
>   target = target.parentNode;
> var href = target ? target.href : "";
>
>
> Karsten
> --
> Feel free to correct my English. :)
> _______________________________________________
> Project_owners mailing list
> [email protected]
> http://mozdev.org/mailman/listinfo/project_owners
>
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to