Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1780 How can I highlight normal text using onMouseover?

You are here: irt.org | FAQ | DHTML | Q1780 [ previous next ]

It's easy enough using the SPAN tag, and it won't cause the entire line to act on the event as a DIV tag will. You can use a mouseover and mouseout to simulate the effect of a roll over. Even javascript can be triggered with an even as part of the SPAN tag. Works in any HTML level 4 browser and up.

<span onmouseover="style.color='red'">Point here for red text.</span>

<span onmouseover="style.color='red'" onmouseout="style.color='black'">Point here to highlight red then change back</span>

<span onmouseover="javascript:alert('I love DHTML')">Point your mouse here for an alert</span>

Submitted by Jeff Summers

©2018 Martin Webb