PDA

View Full Version : InnerHTML mouseover question



Philip M
Dec 8th, 2003, 07:54 AM
I find that:-

<div>
<p onmouseover="this.innerHTML='<B>Mouse out to change back.</B>'" onmouseout="this.innerHTML='<I>Mouse over again to change.</I>'"><I>Mouse over this text to change it.</I>
</p>
</div>

does not work correctly in that the onmouseover part
works fine, but the change back on mouseout does not fire if the
user's mouse pointer is moved away directly vertically up or down
from the changed text. To make the change the pointer must be moved to the right away from the text, then up or down.

I am using IE5.5.

Any comments or solutions, please?

(Oh horror! I see that I have become a JavaScript addict!!!
Is there no category for JavaScript smallbrain or slow-wit?)

Kor
Dec 8th, 2003, 08:38 AM
A statement: The event handlers do fire all the directions but only if the mouse moves over/out the DIV itself, not the text... I presume that the new tags (bold and italics) are responsible to this... If remove them, the handlers will do the job properly... Hm.. I think that you may insert the handlers in the B tags and the I tags also... but seems like an intricate solution....

Philip M
Dec 8th, 2003, 06:31 PM
Thank you Kor!

The following appears to work OK so it looks as though
the <i> tags are the problem.

<div><b>
<p onmouseover="this.innerHTML='Mouse out to change back.'" onmouseout="this.innerHTML='Mouse over AGAIN to change.'">Mouse over this text to change it.
</b></p>
</div>

adios
Dec 8th, 2003, 06:39 PM
...read this while in rehab: :thumbsup:

http://www.brainjar.com/dhtml/events/default.asp

Kor
Dec 9th, 2003, 08:52 AM
I think you will have no problem if using CSS style to give italic and bold properties to text instead of using HTML tags.