Ezequiels mentioned function would require to change every link on that page!
Simply hand event.target you get from your mouseover listener to this
function, and it will either return the link or false, if the mouse
doesn't hover a link:
function findLink(e) {
while(e && e.docName!="#document") {
if(e.href && e.href.length>0) {
return e.href;
}
e=e.parentNode;
}
return false;
}
I think this doesn't work on XLinks, but "a" and "area" stuff should work fine.
It simply walks up the DOM until it reaches its root or finds a link.
If you don't do it this way, it will e.g. fail on the following
constellation: <a href="bla"><span>bla</span></a>
Greetings
xeen
On 6/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> That doesn't account for links in frames/iframes. Make sure you wrap
> Ezequiel's code in a document.frames iteration.
>
>
>
> ----- Original Message ----
> From: Ezequiel Calderara <[EMAIL PROTECTED]>
> To: Mozdev Project Owners List <[email protected]>
> Sent: Thursday, June 28, 2007 10:10:46 AM
> Subject: Re: [Project_owners] mouseover for link monitoring!
>
> Sorry, it was wrong, this is the correct one :P
>
>
> for (i=0;i<document.anchors.length;i++) {
> if (document.anchors[i].href!="") {
>
> document.anchors[i].addEventListener("mouseover",
> MyFunction, false);
> }
> }
>
> On 6/28/07, Ezequiel Calderara <[EMAIL PROTECTED]> wrote:
> > Why are you adding the listener to the document?
> > I really don't know much about event handlers, but i have an idea about
> dom :P.
> >
> > you could do...
> >
> > for (i=0;i<document.links.length;i++) {
> > document.links [i].addEventListener("mouseover",
> MyFunction, false);
> > }
> >
> > That should work well. I didn't tested it.
> >
> > and did you detect which links you don't detect? and why?
> >
> >
> >
> > On 6/27/07, joe ertaba <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi Boys.
> > >
> > > i am going to monitor links in a web page.
> > >
> > > i am using this command:
> > > window.addEventListener("mouseover", MyFunction, false);
> > >
> > > but it seems that it doesn't works for all links, so anybody have other
> ideas ?
> > > maybe something like monitoring status-bar text changing ,...
> > >
> > > _______________________________________________
> > > Project_owners mailing list
> > > [email protected]
> > > http://mozdev.org/mailman/listinfo/project_owners
> > >
> > >
> >
> >
> >
> > --
> > ______
> > Ezequiel.
> >
> > Http://www.ironicnet.com
>
>
>
> --
> ______
> Ezequiel.
>
> Http://www.ironicnet.com
> _______________________________________________
> 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
>
>
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners