query: colour changing text

  • Thread starter xtrmntr: a northern soul
  • Start date
X

xtrmntr: a northern soul

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.
 
Y

Yann-Erwan Perio

xtrmntr: a northern soul said:
i've a website with a navigational frame on the bottom,

That you should avoid, if possible:)
navigational frame, the colour of the text, still in this frame, would
change according to which link i click?


<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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top