Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Apply selected class to one <li> when another <li> is clicked on

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

  • #2
    Regular Coder
    Join Date
    Nov 2009
    Posts
    247
    Thanks
    4
    Thanked 22 Times in 22 Posts
    ladooley:

    First, fix the nearly two dozen validation errors:

    http://validator.w3.org/check?uri=ht...Inline&group=0


    Then fix the CSS error:

    http://jigsaw.w3.org/css-validator/v...ning=1&lang=en


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •