Submit Your Article Forum Rules

Results 1 to 7 of 7

Thread: JavaScript OnMouseOver Underline Text

  1. #1
    Senior Member
    Join Date
    Dec 2003
    Posts
    194

    JavaScript OnMouseOver Underline Text

    Hi. I am trying to use some Javascript code that will allow white text to turn underlined (remaining white) when the mouse rolls over it. I am just starting to learn JavaScript, and I need to get this code up fast.
    Can anybody please help? Thanks so much...
    Best Regards,
    Becky Gessler
    Hidden Content

  2. #2
    Senior Member paulhiles's Avatar
    Join Date
    Jul 2003
    Posts
    2,062
    Hi again Becky,

    Not sure I've understood correctly what it is you're after.. but it sounds to me that you need to be using CSS rather than JavaScript to format text.

    Unless you're after something like a conditional statement.. i.e. if text color is white and a mouseOver event is true then underline??? Unlikely I think! Believe me.. CSS is by far the simpler option!!

    Paul

  3. #3
    Senior Member
    Join Date
    Dec 2003
    Posts
    194
    Hi Paul. Please go to this site:
    http://www.neoseeker.com/
    I am trying to make my text just like they have on the top.
    I thought they were using Javascript, but if I am miskten, please tell me how I am supposed to do this...
    Thanks
    Best Regards,
    Becky Gessler
    Hidden Content

  4. #4
    Senior Member
    Join Date
    Jul 2003
    Posts
    518
    There is no white text there. But as Paul says I think you are after CSS and not javascript. a:hover: text-decoration: underline; to be exact.

  5. #5
    Senior Member paulhiles's Avatar
    Join Date
    Jul 2003
    Posts
    2,062

    A CSS example

    Quote Originally Posted by technica
    Hi Paul. Please go to this site:
    http://www.neoseeker.com/
    I am trying to make my text just like they have on the top.
    I thought they were using Javascript, but if I am miskten, please tell me how I am supposed to do this...
    Thanks
    Hi Becky, I didn't see anything unusual about the neoseeker page.. also there's text links everywhere.. so I'm not sure exactly what section you're hoping to emulate. I'm pretty sure what you're after is the effect of underlined links on a mouseOver.

    a{} // there are 4 classes of the link selector
    a:link {}
    a:visited {}
    a:hover {} // pseudo class (doesn't work in NS4.x)
    a:active {}

    If you have many variations in links on your site, you could create a separate class called 'whitelink' for example. Your stylesheet might contain the following:

    a.whitelink{}
    a.whitelink:link {background-color:transparent; color:#FFFFFF; text-decoration:none}
    a.whitelink:visited {background-color:transparent; color:#FFFFFF; text-decoration:none}
    a.whitelink:hover {background-color:transparent; color:#FFFFFF; text-decoration:underline}
    a.whitelink:active {background-color:transparent; color:#FFFFFF; text-decoration:underline}

    If you're still confused, and need more help, feel free to PM or email me! :o)

    Paul

    PS. I see carbonize has given you the quick solution.. while I've been editing this! Doh!

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    518
    I just give a taster, you give a complete course.

  7. #7
    WebProWorld MVP ronniethedodger's Avatar
    Join Date
    Aug 2003
    Posts
    1,400
    I really like your eye for cross-browser detail here Paul. Cannot forget about them NS4 people, eh? ;-)

    a:hover {} // pseudo class (doesn't work in NS4.x)
    Ronnie T. Dodger
    Hidden Content

Similar Threads

  1. How to open and save text files using Javascript ?
    By Bips123 in forum Web Programming Discussion Forum
    Replies: 10
    Last Post: 11-14-2009, 03:39 PM
  2. Javascript email link with body text - How to?
    By surfing-mtber in forum Graphics & Design Discussion Forum
    Replies: 4
    Last Post: 06-17-2008, 12:56 PM
  3. Is Javascript text seen by SEs?
    By alextj in forum Search Engine Optimization Forum
    Replies: 6
    Last Post: 08-11-2005, 10:54 AM
  4. onMouseOver Redirects
    By plazas-ps in forum Google Discussion Forum
    Replies: 6
    Last Post: 06-10-2004, 04:29 PM
  5. How do I use JavaScript to add text to a page?
    By ReformSchooler in forum Web Programming Discussion Forum
    Replies: 2
    Last Post: 01-22-2004, 08:22 PM

Posting Permissions

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