Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hyperlink text code

    I looked for a Search but found it was temp off so here's my Q

    I need the html code to change the font color of a text link during mouse -over and then back to the default font color on mouse-not-over.


    I know this is quite elementary but I haven't done this in awhile.
    thanks
    Paul

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Hyperlink text code

    You can assign styles to links that specify different attributes for three different conditions: unvisited, visited, and active, and in the latest CSS specification, hover. If your users definitely have a recent browser (e.g., IE 5+) you can use something like this:

    A:hover { color: #red; font-weight: bold; text-decoration: underline }

    For maximum compatibility, or to detect a mouseover on another object, you need to use JavaScript. Here's an example for a completely different purpose, I wanted to highlight text when moused over, but the idea is the same:

    <pre><html>
    <head>
    <title>Sample Trademark Application</title>
    <style>
    body, p, td {font size: 16 pt }
    .hotspan { background-color: yellow;
    cursor: hand }
    .offspan { background-color: transparent;
    cursor: hand }
    </style>
    <script>
    function makeHot(strID)
    {
    //Compatible with IE5+ and NS6+
    var mySpan = document.getElementById(strID);
    mySpan.className = "hotspan";
    }
    function makeOff(strID)
    {
    //Compatible with IE5+ and NS6+
    var mySpan = document.getElementById(strID);
    mySpan.className = "offspan";
    }
    </script>
    </head>
    <body>


    <span id="applicant" onmouseover="makeHot('applicant');"
    onmouseout="makeOff('applicant');">My Client</span>, a California corporation
    having a principal place of business at 123 Main Street, Any Town, USA, has a bona fide
    intention to use the trademark shown in the accompanying drawing in commerce on or in
    connection with the following goods:

  3. #3
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hyperlink text code

    Thanks jscher

    I copied/pasted your code to a new Notepad doc then uploaded it to my website to take a look at it's action. When I tried to open it, I got an error msg that it was expecting a closing curly parenthesis: }
    I don't see any missing. Any clues?

  4. #4
    Plutonium Lounger Leif's Avatar
    Join Date
    Dec 2000
    Location
    U.K.
    Posts
    14,010
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Hyperlink text code

    When I tried copying and pasting it, I found the copy didn't carry the carriage returns - I simply got one line of text which had to be doctored.
    It's possible you have experienced the same and accidentally altered the script - with a } getting the chop. I found the script did work fine, so here is an attachment of the same. Save it and rename the extension to .txt, open with Notepad, and try a copy and paste.
    Attached Files Attached Files

Posting Permissions

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