By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,654 Members | 1,554 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,654 IT Pros & Developers. It's quick & easy.

query: colour changing text

P: n/a
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.
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
xtrmntr: a northern soul wrote:
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>
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.