?
Solved

OnMouseOver event

Posted on 1998-06-21
7
Medium Priority
?
470 Views
Last Modified: 2011-09-20
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
Comment
Question by:phooey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 

Expert Comment

by:dima_sherman
ID: 1844315
Hi, goto http://hey.to/hillz and read the source of the page.
0
 
LVL 2

Author Comment

by:phooey
ID: 1844316
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
 
LVL 8

Expert Comment

by:MaDdUCK
ID: 1844317
did you include a "... return true" statement in the JavaScript line?
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 4

Expert Comment

by:martinag
ID: 1844318
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
 

Expert Comment

by:Spo0n
ID: 1844319
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
 
LVL 2

Author Comment

by:phooey
ID: 1844320
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
 
LVL 8

Accepted Solution

by:
MaDdUCK earned 150 total points
ID: 1844321
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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question