Connecting Tech Pros Worldwide Help | Site Map

query: colour changing text

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 02:31 PM
xtrmntr: a northern soul
Guest
 
Posts: n/a
Default query: colour changing text

alright there,
i'm pretty much throwing myself on everyone here's mercy, as i'm
struggling to even articulate what i mean, never mind create the
behaviour i want.

i've a website with a navigational frame on the bottom, and the main
site taking up the other 90% of the window. each page has got a
different background colour, where as the navigational frame obviously
stays the same.

is there a way that, when i click on one of the links in the
navigational frame, the colour of the text, still in this frame, would
change according to which link i click? from, for example, red, to
yellow or green depending on whether i choose 'pictures' or 'stories',
to match the colour scheme?

well, any help or anything much appreciated,
regards, mark.

  #2  
Old July 20th, 2005, 02:32 PM
Yann-Erwan Perio
Guest
 
Posts: n/a
Default Re: query: colour changing text

xtrmntr: a northern soul wrote:
[color=blue]
> i've a website with a navigational frame on the bottom,[/color]

That you should avoid, if possible:-)
[color=blue]
> navigational frame, the colour of the text, still in this frame, would
> change according to which link i click?[/color]


<div id="navbar" onclick="foo(this, event)">
<a id="foo1" href="foo1.html" target="main">foo1</a>
<a id="foo2" href="foo2.html" target="main">foo2</a>
<a id="foo3" href="foo3.html" target="main">foo3</a>
</div>

<script type="text/javascript">
function foo(bar, evt){
var d=document, a, c, t;
var colors={
"foo1":"yellow",
"foo2":"green",
"foo3":"maroon"
};
if(bar && bar.getElementsByTagName &&
typeof bar.parentNode!="undefined"){

t=evt.srcElement||evt.target;
while(t.nodeType!=1)t=t.parentNode;
if(t && t.href){
a=bar.getElementsByTagName("a");
c=colors[t.id]||"black";
for(var ii=0; ii<a.length; ii++){
a[ii].style.color=c;
}
}

}
}
</script>
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.