View Full Version : InnerHTML mouseover question

Philip M
12-08-2003, 07:54 AM
I find that:-

<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>

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?)

12-08-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
12-08-2003, 06:31 PM
Thank you Kor!

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

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

12-08-2003, 06:39 PM
...read this while in rehab: :thumbsup:


12-09-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.