[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 479
  • Last Modified:

OnMouseOver event

Please could someone tell me why this generates an error?
It seems to work (nearly!)

<font onMouseOver="this.style.font='bold' " onMouseOut="this.style.font='normal'">
<p>Text to change </font></p>

1 Solution
Hi, goto http://hey.to/hillz and read the source of the page.
phooeyAuthor Commented:
This does not really answer my question.  I am already familiar with changing colour, text etc onMouseOver but I want to make the text bold?
did you include a "... return true" statement in the JavaScript line?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I think it is impossible to do what you want to do.
The font colors are changeable because they are set with <FONT></FONT>
But bold is a special tag (<B></B>) and normal hasn't got any tag at all.
This doesn't solve it but it's as close as I could get..so it's not really an answer i spose...

<script language=JavaScript>

function goBold(textIn) {
textaOn = textIn.bold();

function goNormal(textIn) {
textaOff = textIn;

<font onMouseover="goBold('hurro'); return true;" onMouseout="goNormal('indeed'); return true;">indeedily</font>

It works....but wont change back with onMouseout...it seems to kill the page and wont reload...you have to reopen the file.
I tried heaps of things like using ' this ' as input with different results.....none of which worked.  It's really just an image flipping function but the text is making it go a little err 'wobbly'.  :)   Good luck.
phooeyAuthor Commented:
Sorry guys, worked it out myself.  For interest:
Set up two styles, one for onMouseOver and one for onMouseOut.  In the style you can set the font colour and weight and anything else you care to mention.

(Free 10 points to anyone who answers this, just to get it off the list)
DId you set these style up with a style sheet? You could do the font weight thingy right in the tag because unlike bold, font weight is controlled via the font tag (or more like through the style tag)

Do you want this for links or for normal text. If you do it for links, then I guess it is best to define the styles a.link and a.hover because then this will happen automatically.

Good luck!

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now