HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Link color changes
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table
View previous topic :: View next topic  
Author Message
RamyaRajan



Joined: 18 Apr 2008
Posts: 6

PostPosted: Fri Apr 18, 2008 11:46 pm     Link color changes Reply with quote

Hi,this is ramya.
Am new to html and css.
I have a link column in a table.i want to display user visited color and unvisited color...when i refresh the page,the link color should come back to original color..
i have tried something like this....

<script type="text/javascript" language="javascript">

function changecolor(id)
{

document.getElementById(id).style.color='green';
}
</script>
<style type="text/css">
.griditemcolor,
.griditemcolor a:link,
.griditemcolor a:visited {
FONT-SIZE: 11px; text-align:left; FONT-FAMILY:Verdana; line-height:10px;
BACKGROUND: none transparent scroll repeat 0% 0%; color:red;
}
.griditemcolor a:Hover,
.griditemcolor a:active {
FONT-SIZE: 11px; text-align:left; FONT-FAMILY:Verdana; line-height:10px;
BACKGROUND: none transparent scroll repeat 0% 0%; color:gray;
}
#currentpage { color:blue;}
.griditem1 {
FONT-SIZE: 11px; text-align:left; FONT-FAMILY:Verdana; line-height:10px;
}
</style>




<div><td width="100" class="griditemcolor"><a href="Roles.html" onclick="changecolor(1)" id="currentpage"; ><span id="1">search</span></a></td></div>



It works fine in mozilla browser but not working in Internet Explorer...

Help me!

Thanks in Advance
mjpliv



Joined: 11 May 2004
Posts: 406
Location: Nova Scotia

PostPosted: Sat Apr 19, 2008 7:21 am     Reply with quote

Refreshing the page dosen't clear your IE cache therefore your links will not revert back to the original colors.
Straystudio



Joined: 14 Apr 2008
Posts: 228
Location: Nord Italy

PostPosted: Sat Apr 19, 2008 8:03 am     Reply with quote

Without any SCRIPT in the HEAD, take into consideration this way as well:

<td width="100" align="" valign=""><a
href="Roles.html" target="_blank" style="text-decoration: none;"><span
onclick='this.style.color="blue";' style="color: red;">search</span></a>
</td>

In place of declaring style="color: red;" in each one, You can do:

<body link="red">

to declare native color for all links.
RamyaRajan



Joined: 18 Apr 2008
Posts: 6

PostPosted: Mon Apr 21, 2008 3:57 am     LinkColorChanges Reply with quote

I want to open the link in same page..
Now i did in Different manner,
but not much changes,i just reduced the coding,it gives the same result as before,
Let me paste my coding...

Script is written inside the head tags

<script type="text/javascript" language="javascript">

function changecolor(id)
{

document.getElementById(id).style.color='red';

}
</script>
<style type="text/css">
.griditem1 {
FONT-SIZE: 11px; text-align:left; FONT-FAMILY:Verdana; line-height:10px;
}
.griditem1 a:link,
.griditem1 a:visited {
text-decoration:none;
color:blue;
}



</style>


<td width="100" class="griditem1"><a href="Grants.html" onclick="changecolor(1)" ><span id="1">Grants</span></a></td>


//This td tag is inside body and all other constraints.




Now if i refresh the page ,i get the original color..
Its working in mozilla,but not in IE...
If i add target="_blank",its working in IE too,but i want to open the pages in same page.when i come back it should retain the color,when i refresh only the color changed to original blue color...
In short,i want to show the visited and unvisited links difference by color,when i refresh the page,all the color must be changed to blue....


Thanks
Corey Bryant



Joined: 15 May 2004
Posts: 8154
Location: Castle Rock CO USA

PostPosted: Sat Apr 26, 2008 1:22 pm     Reply with quote

You should use styles to specify the colors you want, either visited, active, hover etc.

_________________
Corey
Hosting Solutions | Mile High Merchant Accounts | Expression Web Blog
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Table All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial