width of event target?

D

David Birnbaum

Dear comp.lang.javascript,

I'm attaching a mouseover event handler to a <p> element that consists of just a few words. When I mouse over the element, the event fires, but it also fires when I mouse over the blank space to the right, after the end of the textual content. This latter behavior is distracting to my users, who don't expect mouse movements in that area to interact with the <p> because as far it looks to them, the <p> ends where the visible text ends.

I'm guessing that this happens because the width of my <p> is being reported as 100% of the width of the containing <body> element. Is there a way to change this behavior, so that the event will fire only when the user mousesover the visible text within the <p>? I tried attaching the event to the text node within the <p>, and that generates no errors when loading (Firefox4 on Windows 7), but it also doesn't work--the mouseover event generates no errors, but it simply doesn't fire.

Thanks,

David ([email protected])
 
D

Denis McMahon

I'm guessing that this happens because the width of my <p> is being
reported as 100% of the width of the containing <body> element.

I think that the width of your paragraph, which is a block level element,
is 100% of the containing element, unless you specify it to be narrower.

Not "is being reported as" but "is".

Rgds

Denis McMahon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top