473,408 Members | 2,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Change link color when click

250 100+
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
2 3981
TheServant
1,168 Expert 1GB
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
916 512MB
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

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

Similar topics

2
by: Danny | last post by:
Hello I am looking for an asp change password solution. I know there are very efficient ways of doing it and perhaps you have some samples or ideas. Basically I would like the user to be able...
3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
5
by: Matt | last post by:
I created 3 hyperlinks, when the user click each link, it will change the color of the text of a link. For example, when user clicks Link1, text Link1 will become red color, but Link2 and Link3...
7
by: Mike Mimic | last post by:
Hi! I am trying to implement link click counter so that user can still bookmark the link (I rather see that click is not counted than user have "problems"). <a href="http://www.google.com/"...
2
by: Ben | last post by:
Hi. I have a button that change a number of images src's when I click a button. The src's are stored in an array and I just use document.src=pics to change the src of the image. However I want...
11
by: Yeah | last post by:
I have a multiple choice quiz where I would like to use CSS to change the color of the answers upon clicking them. I would like to present the right and wrong answers up front, rather than direct...
6
by: Karl | last post by:
Hi, Ok so on a given page I have 4 text links: see it in black see it in blue see it in red see it in green using the standard swap image behavior, clicking on one of the above links
2
by: rich | last post by:
I am working on a page with a right column that I want to use for navigation. In this right column I am using the below code to set a value for the link. I am using the variable $test right now....
5
by: james.calhoun | last post by:
I feel like this should be really easy... I want a hidden field in a form to have its value defined when someone clicks on a link. So if they click on link "A" the value of the hidden field...
22
by: subashinicse | last post by:
hi to everybody, am new to this forum.. am working with J2ee,i have a jsp page where i have some links,i want to change the link color when it is active,and it has to turn back to original color...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.