Are you a Google Analytics enthusiast?
Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE!

www.CustomReportSharing.com
From the folks who brought you High Rankings!
More SEO Content
Anchor Tags Changing Color Of Link Text
#1
Posted 07 March 2005 - 08:08 PM
If this is unclear I can give you the address so you can see.
I asked for help on another forum and this is the response someone posted...
"That's probably because you have used "#" for your links at the moment, no?"
I told him that is true. Then he responded with...
"They are all the same link, therefore when you hit one, you hit them all. By the way, it's better to use "java script:;" (that's colon semicolon) than "#".
So I just removed the # sign and replaced it with java script:;
I did this to the links that are on the same page as the anchor tags as well as other pages that link to that page, at that anchor spot.
I followed his advice but then the links just went to a blank white page, they stopped working. I have never, ever used javascript so please treat me like someone who doesn't even know a word of english.
Any help is appreciated. By the way, I am using dreamweaver 3.
Thanks,
Jarrod
#2
Posted 07 March 2005 - 08:38 PM
Having said that, here is how you would use the JS:
<a href="javascript:location='/mypage.htm#anchorName'">Link Text</a>
#3
Posted 07 March 2005 - 10:19 PM
#4
Posted 07 March 2005 - 10:38 PM
Jill, I missed you at SES. The show is huge isn't it?
The issue I was having was that as soon as someone clicked on one of the links it would correctly take them to the correct anchor spot on the page - whether they clicked the nav bar from the same page the anchor spot was located or another page in the site. But after one of the links was clicked, all the links that were anchor links, or whatever the correct term is, would show up with the visited link color and I did not want that to occur.
Do you know of a way I can just make each link act separately? Is it preferable to not use javascript?
#5
Posted 07 March 2005 - 11:21 PM
What I would probably do is use a bit of CSS to give those particular links that contain a # in-page link a class of their own. Then make the A and A:visited both the normal text color.
They won't ever get the visited coloring that way, but that's better than have a series of links change all at once.
#6
Posted 07 March 2005 - 11:35 PM
Could you elaborate on this please...
"What I would probably do is use a bit of CSS to give those particular links that contain a # in-page link a class of their own. Then make the A and A:visited both the normal text color".
I think I understand the general thought (if what I said up top is right) but the details you mentioned don't ring a bell with me.
#7
Posted 08 March 2005 - 08:20 AM
Essentially, that's the gist of it. Though you could control the hover and active colors separately if you wanted.
Let's say for instance your same page link text was a darkish blue color and you wanted it to change to a lighter blue when someone hovered over it or when it was clicked on, or active. But you wanted it to be the normal dark blue any other time.
We simply create a little class for those same page links and we're good to go. Something like the following should work after being tweak to match what you're doing with your links.
<!--
.samepagelink, a.samepagelink, a.samepagelink:visited {
font-family: Arial, Helvetica, sans-serif;
color: #333399;
font-size: .9em;
font-weight: normal;
}
a.samepage:hover, a.samepage:active {
font-family: Arial, Helvetica, sans-serif;
color: #660033;
font-size: .9em
text-decoration: none;
font-weight: normal;
text-decoration: none;
}
-->
</style>
Then in your HTML when you link to these same page anchors, simply add a class to the A HREF tag to tell the browser which class to use. Like:
#8
Posted 08 March 2005 - 11:49 AM
Thanks a bunch. I'll take a shot at it and see what disaster I can cause. LOL
I appreciate you taking the time.
One question as of now...
When you started the code... <style type="text/css"> where do I insert this?
Jarrod
#9
Posted 08 March 2005 - 12:46 PM
If you're going to put it in each page of your site, the <style.. section would optimally go inside the <head> section of your page. If you're doing across all pages of your site, especially if you have other CSS being used, I would use an External CSS file and call it into each page with a single <link rel= line.
#10
Posted 08 March 2005 - 01:24 PM
This nav scheme will be in almost every page (the site will be approx. 12 pages more or less). I'm not using any CSS. Would you recommend using the external CSS file, which would be a first for me as well.
Thanks
#11
Posted 08 March 2005 - 01:33 PM
Putting it into the head section of each page for a 12 page site is probably the easiest. 100 pages would be another story.
#12
Posted 08 March 2005 - 03:28 PM
Much thanks.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users









