View Full Version : With my change text function can I also style my font as well?

10-11-2008, 09:00 AM
I found a "change text" script that changes snippets of text (that you've pre-programmed) in a div as you mouseover different links.

I was playing with it to see if I could vary the font size and color of INDIVIDUAL WORDS in the output, but was unsuccessful.

I have a link below to my experimental page containing the script, plus showing the kind of font property changes that I thought might be possible.

Since I'm relatively new to javascript, I may be asking a dumb question. Just wondering, even though the text data has to pass through all of these functions, can you still somehow set varying font properties in the output? Or can someone suggest a work around (hopefully not too painful)?

Here's the link to my experimental page: http://homepage.mac.com/ccfinder/movieclassics/changetext.html


10-11-2008, 10:40 AM
You can hand code any element in the messages there. Let me quote this part:

messages[1]="<span class='style1'>So I found this cool</span> way of changing text in a stationary spot by mousing over different links."

...you can add highlighted.

Which gives you the opportunity to give that element a style via CSS:


You can do the same thing on the other messages.

Hope that makes sense.

10-11-2008, 07:19 PM
Great! Thanks very much.