HighDots Forums  

Active link problem driving me nuts!!!

Javascript JavaScript language (comp.lang.javascript)


Discuss Active link problem driving me nuts!!! in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fran Cotton
 
Posts: n/a

Default Active link problem driving me nuts!!! - 07-11-2003 , 07:03 AM






How do you stop the "active link" colour from disappearing when you click on
a div or span
part of a javascript tree that doesn't result in a new page being displayed,
only a new branch
being opened or closed?

I'll clarify further:

Imagine the following tree where (h) means the node is a hyperlink:

Products
product a (h)
product b (h)
Services
IT
bespoke software (h)
Eductation
tutoring (h)
consultancy (h)
About Us (h)

If I select About Us, my main frame updates and About Us turns green ( my
active link colour ) as expected.
If I then click on tutoring, the green colour shifts and the frame updates
as expected. However, if I then click
on IT, I lose the active link on tutoring!! This shouldn't happen as the
tutoring page is still being shown in the
main frame. The tutoring tree node shouldn't lose its active link colour as
IT is a branch in a tree, not a leaf node
or document to be rendered and hence be active.

Many thanks in advance! ( this is driving me nuts! )

btw, I'm using Internet Explorer 5.5 if that helps.

Fran



Reply With Quote
  #2  
Old   
Russ Edkins
 
Posts: n/a

Default Re: Active link problem driving me nuts!!! - 07-11-2003 , 11:38 AM






Hi Fran,

If I've understood you correctly, the reason your previously active
link loses it's colour, is because it is loosing focus when you click
on the DIV or SPAN, and hence is no longer the active item, even
though your content may not have changed. I think you'll need to try
something other than using CSS psuedo classes (:active, :link etc.) to
drive colours. It sounds like what you're essentially asking is that
the highlighted link is tied directly to the currently displayed
content. If you're using frames, you could maybe do something like...

<a href="#" style="color:expression(parent.content.location.hr ef.indexOf('productA')!=-1
? 'green' : 'blue')">Product A</a>

....but this relys on you being able to identify a unique string in the
HREF of each page, it will only work in IE5+ and it could add quite a
lot of weight to the page, so without more info on your set up and
audience I can't say if this will definitely work.

You could also make each content frame set the colour of it's
corresponding HREF.

I would imagine there are lot of other ways too, but I just don't
think you can rely on A.active psuedo class, and you'll need to try
something different.

HTH

Russ.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.