REQ: help with event and inner tag.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • .

    REQ: help with event and inner tag.

    TIA for your help with is quick question:

    document.onkeyu p=test;
    document.onmous edown=test;

    function test(evt){
    myEvent=window. event?event.src Element:evt.tar get;
    alert(myEvent.h ref);
    }

    Works great for a link like:
    <a href="http://www.google.com" >Google</a>
    The alert properly shows http://www.google.com.

    However this:
    <a href="http://www.google.com" ><i>Google</i></a>
    returns undefined. How can i get the href?

    The <i> and it's placement is not my doing, I'm forced to deal with
    it.

    Thanks much,

    Rick
  • .

    #2
    Re: REQ: help with event and inner tag.

    Just found my answer on msdn.com, here it is:

    In IE
    alert(myEvent.p arentElement.hr ef);

    In Mozilla
    alert(myEvent.p arentNode.href) ;

    HTH


    On Tue, 10 Aug 2004 06:09:00 +0900, . <me@me.com> wrote:
    [color=blue]
    >TIA for your help with is quick question:
    >
    >document.onkey up=test;
    >document.onmou sedown=test;
    >
    >function test(evt){
    > myEvent=window. event?event.src Element:evt.tar get;
    > alert(myEvent.h ref);
    >}
    >
    >Works great for a link like:
    ><a href="http://www.google.com" >Google</a>
    >The alert properly shows http://www.google.com.
    >
    >However this:
    ><a href="http://www.google.com" ><i>Google</i></a>
    >returns undefined. How can i get the href?
    >
    >The <i> and it's placement is not my doing, I'm forced to deal with
    >it.
    >
    >Thanks much,
    >
    >Rick[/color]

    Comment

    Working...