List of hyperlinks

Last post 10-04-2007 5:23 PM by musclejj. 7 replies.

Sort Posts:

  • List of hyperlinks

    09-25-2007, 6:59 AM
    • Loading...
    • musclejj
    • Joined on 12-10-2006, 5:14 AM
    • Posts 10

    hi all

    I would like to display a list of hyperlinks using a repeater control (datalist, detailsview, bulleted list) are all fine.

    But when i click on the hyperlink, i would like the background of the hyperlink to change green

    but all other hyperlinks remain uncolored.

    Is this possible? Is this done in CSS?

    Thanks for the help!

    :)

  • Re: List of hyperlinks

    09-25-2007, 7:13 AM

    Yes CSS can do that for you.

     

    <!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">
            a.link:visited{
                color: green;
            }
        </style>
    </head>
    <body>
        <a class="link" href="#">One</a>
        <a class="link" href="#">Two</a>
    </body>
    </html>
  • Re: List of hyperlinks

    09-25-2007, 7:22 AM
    • Loading...
    • johram
    • Joined on 06-13-2006, 10:36 AM
    • Sweden
    • Posts 3,352
    • Moderator

    I think he meant that the background should change when you click on it (before the other page has been loaded). This can be achieved in two ways.

    Either you set the background color for a:active in your style sheet, like this:

    a:active {
      background-color: yellow;
    }

    Or you can use a JavaScript that change CSS class when you click on the link.

    If this post was useful to you, please mark it as answer. Thank you!
  • Re: List of hyperlinks

    09-25-2007, 9:22 AM
    Answer

    Oh! well, you can change my first post and try with:

    a.link:hover - To change while the mouse pointer is over the hyperlink
    a.link:active - As said by our colleague
    a.link:visited - When the link has been visited

  • Re: List of hyperlinks

    09-26-2007, 3:40 AM
    • Loading...
    • musclejj
    • Joined on 12-10-2006, 5:14 AM
    • Posts 10

    Hi both, thanks for your help! It works but now i have another issue.

    When the hyperlinks post back to the original page, i wanna see that link that was just clicked background colored and the other links uncolored.

    The behavior right now is when it postback to the page, the background color is gone.

    Thanks again!

    J

  • Re: List of hyperlinks

    09-26-2007, 4:45 AM

    Are you talking about hyperlinks o Linkbuttons?

  • Re: List of hyperlinks

    09-26-2007, 4:54 AM
    Answer
    • Loading...
    • johram
    • Joined on 06-13-2006, 10:36 AM
    • Sweden
    • Posts 3,352
    • Moderator

    I think you should be looking at the SiteMap control instead. If you have a static menu, it is fairly easy to set up and you will get exactly the behaviour you want.

    It is possible to do this without using the SiteMap too but there's no simple way to do it (afaik), so it will require some hacking ;-)

    If this post was useful to you, please mark it as answer. Thank you!
  • Re: List of hyperlinks

    10-04-2007, 5:23 PM
    • Loading...
    • musclejj
    • Joined on 12-10-2006, 5:14 AM
    • Posts 10

    Hi Hans,

    I am talking about link buttons.

    :)

Page 1 of 1 (8 items)
Microsoft Communities
Page view counter