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 3 of 3

Thread: link problem

  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    link problem

    Hi everyone, Im having a bit of a problem getting a onClick to change the different link values.

    Im trying to switch the black ground and link colors, but I cant figure out the right 'definition' for the link styles..

    I can get this to work for the background color,
    onClick="document.body.style.backgroundColor = 'white';"

    But I dont know what to type after document.body.style. for the different link values, a:link v:link etc. Ive been searching google for a couple hours and just cant seem to find anything on it.

    Thanks.

  • #2
    Regular Coder
    Join Date
    May 2007
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 18 Times in 18 Posts
    You won't like my choice of colours but it works otherwise:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>Untitled Page</title>
    <style type="text/css">
    .xxx {background-color: #ccffcc}
    .xxx a:link {color: #f00}
    .xxx a:visited {color: #800080}
    </style>
    </head>
    <body>
    <div>
    <a href="#">Going nowhere...</a>
    <input type="button" onclick="javascript:document.body.className='xxx';" value="All change" />
    </div>
    </body>
    </html>

  • Users who have thanked SouthwaterDave for this post:

    kazuri (09-29-2007)

  • #3
    New to the CF scene
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hey thanks a lot, worked like a charm!


  •  

    Posting Permissions

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