Change link color when click

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    #1

    Change link color when click

    In my php web site I have left pannel which is having links to all pages. I want to change link color or background color when clicked. How can I do that? This is my current code. Could someone help me?
    [code=php]
    $array1 = array("A"=>'A.p hp',"B"=>'B.php ', "C"=>'C,"D"=>'D .php',"E"=>'E.p hp',"F"=>'F.php ');
    $arraypre = array();

    switch ($type){
    case "User1":$arrayp re = array('G'=>'G.p hp','H'=>"H.php ",'I'=>"I.php") ;break;
    case "User2" :$arraypre = array('G'=>'G.p hp');break;
    case "User3" :$arraypre = array('G'=>'G.p hp');break;
    }

    $array = array_merge($ar raypre, $array1 );
    [/code]
    Last edited by Atli; Feb 20 '09, 09:43 AM. Reason: Replaced the [quote] tags with [code] tags.
  • TheServant
    Recognized Expert Top Contributor
    • Feb 2008
    • 1168

    #2
    You can use javascript or the a:active class in css.

    PHP will not help because PHP is server side, so once the page has been sent to the browser (and the user can see it) it is out of PHP's hands and into the realm of javascript and html.

    Comment

    • tharden3
      Contributor
      • Jul 2008
      • 916

      #3
      Unless you want to use Javascript, the CSS method is pretty easy to do. Look here if you need further explanation on using CSS to manipulate links. As suggested by TheServant in the post above, your looking at using the " a:active " property.

      Comment

      Working...