...

View Full Version : Apply selected class to one <li> when another <li> is clicked on



ladooley
09-04-2010, 02:24 AM
Hi,

I currently have a script that dynamically adds a css class called "on" to a menu item once it is selected, turning that link red to show that it's active.

Here is the web page:

www.talmagecooley.com/films.html

As you can see, if you click on "Dimmer" or "Pol Pot's Birthday", or one of the three Patriotville scene links (1, 2, or 3), those links stay red.

But what I need to happen is that when the user hovers over OR clicks on "1", "2", or "3", the word "Patriotville" also turns red along with those links.

Here is the current code:

<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
var Lst;

function CngClass(obj){
if (Lst) Lst.className='';
obj.className='on';
Lst=obj;
}

/*]]>*/
</script>



<li class="rss-popup" id="patriotville"><a id="three" href="#" onclick="" class="feed-link" style="color:#fff;">PATRIOTVILLE</a></li>

<div id="clips">
<li class="rss-popup"><a id="four" href="#" onclick="changeIt('film3_1');CngClass(this);">1</a></li>
<li class="rss-popup"><a id="five" href="#" onclick="changeIt('film3_2');CngClass(this);">2</a>|</li>
<li class="rss-popup"><a id="six" href="#" onclick="changeIt('film3_3');CngClass(this);">3</a></li>
</div>

**********

Any help would be greatly appreciated! Thanks!!

Sciliano
09-04-2010, 01:09 PM
ladooley:

First, fix the nearly two dozen validation errors:

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.talmagecooley.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0


Then fix the CSS error:

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.talmagecooley.com%2F&profile=css21&usermedium=all&warning=1&lang=en



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum