Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Mouseover problem

    Hi
    I got a script to change text from black to red when the mouse goes over it. It wirks ok but the problem is that it permantly changes the text to bold when I want the text to sttay regular. Can anyone fix this script for me as i am completely dumb when it comes to codes.
    Here is the script:

    Code:
    a style="text-decoration: none" href="balls.htm" >
    			<font color="#000000" face="Georgia"><b onmouseout="this.style.color = 'black';" onmouseover="this.style.color = 'red';">SCHOOL BALLS</font></a></td>
    Thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    <font color="#000000" face="Georgia"><b

    delete the ><b which appears to be a typo error.


    "A weak currency reflects a weak econony and a weak government". - Gordon Brown, now the UK Prime Minister, 1992.
    Last edited by Philip M; 05-13-2009 at 07:26 PM.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    I think the <b> was on purpose, but he forgot the </b> tag. In any case, it's a horrible mish-mash of styles and an obsolete <font> tag.

    So cliean it up properly: move the JS events to the <A> tag. And use style in place of the <font> and <b> tags.

    And not strictly necessary but a good idea: Put in some alternate fonts in case user doesn't have Georgia on his/her machine.

    Code:
    <td>
        <a href="balls.htm" 
           style="text-decoration: none; color: black; font-family: Georgia, Verdana, sans-serif; font-weight: bold;" 
           onmouseover="this.style.color = 'red';"
           onmouseout="this.style.color = 'black';" 
        >SCHOOL BALLS</a>
    </td>
    p.s. to Philip: LOL on that quote!

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    font-weight: bold;

    But the guy wants regular NOT bold!

    font-weight: normal;
    Last edited by Philip M; 05-13-2009 at 07:33 PM.

  • #5
    New to the CF scene
    Join Date
    May 2009
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Old Pedant
    Thanks very much, I took out the font families and left it on my default font which is Times New Roman and took out the bold bit and now it is working great.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Teach me to read code, only, and not the question itself.

    Anyway, glad it works.

    rugrotts: It does NOT hurt to use font-family if you would like a special font to appear when possible. Just so long as you realize that if the font you specify isn't there then the browser will take your second choice, then your third, etc. And if it can't find any of your choices then it will use the default. So no harm just using font-family: Georgia; if you want. If the user doesn't have Georgia, it will default to the page font of Times New Roman.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •