PDA

View Full Version : Change word upon mouseover.



drluv888
06-28-2011, 04:23 AM
Hi All,

I'm just looking for a way to change a word in a sentence upon mouseover that word.

Any help'd be appreciated.

djr33
06-28-2011, 04:46 AM
You can apply a rollover effect like with images. Use a <span> and use onmouseover to change the innerHTML. If you need to change it back, use onmouseout the same way.
Do you just want a place to start or do you need someone to write this for you?

Also, do you want this to be a quick version that works once? Or will you use it in many places on your page? (Harder to setup that way, but more efficient.)

Nile
06-28-2011, 05:39 AM
Doing what djr33 said, use the following code. http://jsfiddle.net/nile/Z83nA/

drluv888
07-05-2011, 09:38 PM
I'm getting a strange error: /dk/:8Uncaught TypeError: Cannot read property of 'dataset' of underfined.

What would be the quick way to do use it just once? (As in, only one <span> is changeable). I only need it in one place.

Nile
07-05-2011, 10:07 PM
http://jsfiddle.net/Z83nA/5/