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

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

Ta.
0
phooey
Asked:
phooey
1 Solution
 
dima_shermanCommented:
Hi, goto http://hey.to/hillz and read the source of the page.
0
 
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?
0
 
MaDdUCKCommented:
did you include a "... return true" statement in the JavaScript line?
0
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!

 
martinagCommented:
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.
0
 
Spo0nCommented:
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();
document.write(textaOn);
}

function goNormal(textIn) {
textaOff = textIn;
document.write(textaOff);
}

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

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.
0
 
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)
Dave.
0
 
MaDdUCKCommented:
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!
0

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