Forum Moderators: open

Message Too Old, No Replies

All javascript links turn to visited color in ie6

         

roadsider

8:58 pm on Aug 2, 2007 (gmt 0)

10+ Year Member



I've searched and searched for a solution to this problem. I've built a site in Dreamweaver. All links to that take the viewer outside the website are to open in their own browser window set at 800 x 600 pixels. Therefore, I use DW's Open Browser Window Behavior on all of these links.

Here's the funky part:

When I click on a link to take me to another page WITHIN the site, all the javascripted links turn to their a:visited color.

This only happens in IE6. Works fine in IE7 and Firefox Mac/PC.

What is going on?

Sample code:

Code in the Head:

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

Code at the link:

<p class="darktext"><a href="#hitnews01" onclick="MM_openBrWindow('http://www.example.com/', 'healthcareitnews', 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, width=800, height=600')">Healthcare IT News</a></p>

Here's the CSS:

a:link {
text-decoration: none;
}
a:visited {
color: #6699CC;
text-decoration: none;
}
a:hover {
color: #F7931D;
text-decoration: none;
}
a:active { color: black; }

Please help. If I had hair, I'd have pulled it out by now.

Randy

[edited by: jatar_k at 9:00 pm (utc) on Aug. 2, 2007]
[edit reason] no urls thanks [/edit]

londrum

9:04 pm on Aug 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



it's probably to do with what is written down in the href. you've got it down as
href="#hitnews01"

which is an internal page link -- it points to somewhere on the same page you're on.

the browser must be thinking that it's a visited link, because you're already there.

roadsider

1:59 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



" it's probably to do with what is written down in the href. you've got it down as
href="#hitnews01" "

I coded the href like that as an attempt to make each link distinct from the other. When I use the default "#", all the javascripted links change as soon as I click just one of them. My problem is that when I click a link to take me to another page in the site, ALL the js'd links turn color. I have to reset my cache to bring everything back to the default.

This happens if I make the href "#" or "javascript;:" or "javascript:void(0);"

Trace

2:04 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



That's the exact behavior it's supposed to have.

roadsider

5:41 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



Okay, perhaps I'm not explaining myself well enough. Let's try this again:

I have a site set up with many links to external sites as well as navigational in-site links. All the external links are coded to show up in a new browser window. Javascript is used to make this happen. These links show up on every page.

I have also coded in a .css file an a:visited link, which changes the color to something besides purple, but after experimenting, this problem arises even when using the default a:visited color.

Here's the problem: Whether or not I actually click one of the javascripted links, ALL of them simultaneously change to the a:visited color whenever I navigate to another page WITHIN the site.

1. Click to another page

2. See a whole bank of un-clicked links turn color.

I don't think this is how this behavior is supposed to work, and it only happens in IE6.

Thanks.

Randy

Trace

6:29 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



I hear ya but all of your HREFs are pointing to the same place. You would need to have unique addresses for each link.

Maybe something like this?

<p class="darktext"><a href="http://www.google.com" onclick="MM_openBrWindow(this.href, 'healthcareitnews', 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, width=800, height=600'); return false;">Healthcare IT News</a></p>

I'm using unique addresses in the HREF and still using your openBrWindow function.

Is that what you were looking for?

roadsider

7:01 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



No, what I have is more like this:

<a href="#0801_01" onclick="MM_openBrWindow('http://www.example1.com','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600')">blah blah</a>

<a href="#0801_02" onclick="MM_openBrWindow('http://www.example2.com','','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=600')">yada yada</a>

If I click on example1, it will then turn to the VISITED color. But then, if I click to another page on the site, example2, 3, 4, 5, etc., will also turn visited.

RG

Etc.

londrum

7:09 pm on Aug 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you need to stop pointing the href's at the same page. do it like trace suggests and it will be alright. his code still does the same thing that you are doing already, and it will be more user-friendly too - because the links will still work with javascript turned off.

roadsider

7:31 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



If I do it as Trace suggests, then the window behind the popped up browser window will show that particular page. In his example, he puts in the URL to Google. This would make the Google site appear behind the popped up window. I can't have that.

Also, I don't really have to worry about universal user-friendliness since the site is on an intranet where everyone uses IE6 on a Windows2000 platform.

londrum

7:51 pm on Aug 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



the thing is, when it comes to setting the a:link colors, the browser doesn't reference the url that is placed inside your javascript -- it uses the one that is inside the href.

so if you want it to correctly recognise the outside link as being visited or not visited or whatever, then you need to place it inside the href.

there is no way around it.

Trace

7:55 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



#something
#somethingElse
#somethingElseElse

...they're only anchors that are all on the same page. Again, it's behaving exactly like it's supposed to.

And if you had tried what I suggested, a popup would happen and the main page would not be affected. That's what the "return false" accomplishes.

roadsider

8:29 pm on Aug 3, 2007 (gmt 0)

10+ Year Member



Wow. Many thanks, and my apologies for my expressed frustration. I didn't see the "return false;" attribute. To paraphrase Dr. McCoy, "Dammit Jim, I'm a designer, not a coder!"

Everything seems to be working. I have a lot of changes to make.

Thanks again.