query: colour changing text

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xtrmntr: a northern soul

    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.
  • Yann-Erwan Perio

    #2
    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(th is, event)">
    <a id="foo1" href="foo1.html " target="main">f oo1</a>
    <a id="foo2" href="foo2.html " target="main">f oo2</a>
    <a id="foo3" href="foo3.html " target="main">f oo3</a>
    </div>

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

    t=evt.srcElemen t||evt.target;
    while(t.nodeTyp e!=1)t=t.parent Node;
    if(t && t.href){
    a=bar.getElemen tsByTagName("a" );
    c=colors[t.id]||"black";
    for(var ii=0; ii<a.length; ii++){
    a[ii].style.color=c;
    }
    }

    }
    }
    </script>

    Comment

    Working...