473,320 Members | 1,921 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,320 software developers and data experts.

How to temporarily-permanently change link color when accessing page

1
Hi,

in building a navigation system, I would like to use a system where I have, say, four links which naturally are different pages. Initially, all links are, say, blue. When clicking on the first link, it would change its color to, say, green. Clicking on the second link, the first link would change back to blue and the second link from blue to green. An so forth.

I am a newbie when it comes to Javascript and in searching, haven't found anything that would satisfy the specific need I have. I'm also not sure if this can be done in Javascript or do I need to have PHP involved also (which is what I'm using for back-end stuff).

I have the following code but I doubt it will work:
Expand|Select|Wrap|Line Numbers
  1. function Colorize(element) {
  2.  if( document.getElementById )
  3.   document.getElementById(element).color = "#0f0";
  4.  else if( document.all )
  5.   document.all[element].color = "#f00";
  6. }
  7.  
..but this does not work, when for example using with a link such as these:

Expand|Select|Wrap|Line Numbers
  1. <div id="navi">
  2.  <a id="link_1" href="page1.php" onClick="return Colorize('link_1')">one</a>
  3. <a id="link_2" href="page2.php" onClick="return Colorize('link_2')">two</a>
  4. <a id="link_3" href="page3.php" onClick="return Colorize('link_3')">three</a>
  5. <a id="link_4" href="page4.php" onClick="return Colorize('link_4')">four</a>
  6. </div>
  7.  
Would it be more cost-efficient to store the currently accessed page into a session variable and depending on its value, colorize links? Can this at all be done in Javascript?
Sep 13 '10 #1
1 2254
RamananKalirajan
608 512MB
Hi,
It's not about using color for changing th text color.You have to use link, alink, vlink to chang the color of the <a>. Please refer this site

Thanks and Regards
Ramanan Kalirajan
Sep 14 '10 #2

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

Similar topics

6
by: Fran Shescher | last post by:
If you have damaged any of your Visual Basic Professional 3.0 disks, replacements can be found here: http://www.geocities.com/peanutbutter88888 This is ONLY for LEGAL users of VB Pro 3 ......
2
by: Eino Mäkitalo | last post by:
It seems that urrlib2 default redirection does not allow me to handle Cookies. Service I'm trying seems to use IP switcher and session id's with cookies. After successful login it changes session...
6
by: Tuong Do | last post by:
Hi, I am going to insert a large amount (200,000 records) of data into a table Is there a way that I can temporarily disable the log? so that the insertion run faster Thanks in advance
2
by: Alison | last post by:
Hi, All, How to temporarily termniate a process and then restart it in VB .Net? (Should not kill the process since it is still needed in the program later). Thanks for the help. Alison
2
by: G.Ashok | last post by:
Hi, Is there a way to suspend the background compilation of VB.NET in VS.NET IDE? I want to define a macro key to temporarily suspend and resume the background compilation. Regards,...
4
by: Ben-Nes Michael | last post by:
Hi everyone From time to time i get the following error: could not fork new process for connection: Resource temporarily unavailable im using Postgres 7.4.5, with kernel 2.6.2 my conf is: ...
37
by: Vince C. | last post by:
Hi all. I've installed Bloodshed Dev-C++ on a Windows 2000 SP4 machine. I'm using MinGW 3.4.2. I'd like to temporarily disable standard functions to write to stderr, i.e. for instance...
6
by: billiejoex | last post by:
Hi there. I'm writing a modification for a FTP server library I'm maintaining. Depending on the system I'd want to temporarily impersonate the logged user to perform actions on filesystem....
3
by: amolbehl | last post by:
Hi, I have too many inserts to deal with but the at specific part of the code is intense on computation where I would like to temporarily close connection and then once the computations are...
3
by: JulesII | last post by:
Hi, I have a database which is able to show projects which are current and those which are archived. The users need to be able to search the archived data but are not allowed to edit it in anyway. ...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.