By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Change link color when click

100+
P: 250
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?
Expand|Select|Wrap|Line Numbers
  1. $array1 = array("A"=>'A.php',"B"=>'B.php', "C"=>'C,"D"=>'D.php',"E"=>'E.php',"F"=>'F.php');
  2. $arraypre = array();    
  3.  
  4.                         switch ($type){
  5.                         case "User1":$arraypre = array('G'=>'G.php','H'=>"H.php",'I'=>"I.php");break;
  6.                         case "User2"            :$arraypre = array('G'=>'G.php');break;
  7.                         case "User3"        :$arraypre = array('G'=>'G.php');break;
  8.                         }
  9.  
  10.         $array = array_merge($arraypre, $array1 );
  11.  
Feb 20 '09 #1
Share this Question
Share on Google+
2 Replies


TheServant
Expert 100+
P: 1,168
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.
Feb 20 '09 #2

tharden3
100+
P: 916
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.
Feb 20 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.