 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
RamyaRajan
Joined: 18 Apr 2008 Posts: 6
|
Posted: Fri Apr 18, 2008 11:46 pm Link color changes |
|
|
|
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
|
Posted: Sat Apr 19, 2008 7:21 am |
|
|
|
| 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: 238 Location: Nord Italy
|
Posted: Sat Apr 19, 2008 8:03 am |
|
|
|
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
|
Posted: Mon Apr 21, 2008 3:57 am LinkColorChanges |
|
|
|
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 Site Admin

Joined: 15 May 2004 Posts: 8199 Location: Castle Rock CO USA
|
|
|
|
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
|
|
|
|
|
 |
|
|
|
|
|
|
|