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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Navigation Menu help

    Hi,
    I have a navigational menu with checkboxes used for a search.
    In that the list comes like this

    1.Region
    Americas
    EMEA
    APJ


    2.Country
    USA
    Canada
    India

    3.Location
    Los Angeles
    Toronto
    Mumbai

    What i want to do is when i select Americas, only countries comes under Americas has to be displayed, same for all 3 categories.

    What should i do to get the result?

  • #2
    New Coder
    Join Date
    Aug 2013
    Posts
    50
    Thanks
    0
    Thanked 11 Times in 11 Posts
    I don't understand.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,038
    Thanks
    23
    Thanked 589 Times in 588 Posts
    maxdeeps, are you really talking navigational menu? with checkboxes??

    We need code. We don't write code, we correct coding mistakes.

    If you need code Google it.
    Here's help http://net.tutsplus.com/tutorials/de...vigation-menu/

    Good luck
    Evolution - The non-random survival of random variants.

  • #4
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    This is my code,
    ////////////////////////////////////////////////////////////////////////
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>

    <!--toggle script
    -->
    <script language="javascript">
    function toggle(divId) {
    var divArray = document.getElementsByTagName("div");
    for(i = 0; i < divArray.length; i++){
    if(divArray[i].id == divId){
    if(divArray[i].style.display != 'none'){
    divArray[i].style.display = 'none';
    }else{
    divArray[i].style.display = '';
    }
    }
    }
    }
    </script>

    <!-- -->
    </head>

    <body>
    <li> <a href="#">Region</a>
    <ul>
    <li ><a href="#">
    <input type="checkbox" onClick="toggle('uk');" name="AMR" id="AMR" />
    <label for="AMR"></label>
    Americas</a></li>
    <li><a href="#">
    <input type="checkbox" onClick="toggle('usa');" name="EMEA" id="EMEA" />
    EMEA</a></li>
    <li><a href="#">
    <input type="checkbox" name="APJ" id="APJ" />
    APJ</a></li>
    </ul>
    </li>
    <li> <a href="#">Country</a>
    <ul>
    <div id="usa"> <li ><a href="#">
    <input type="checkbox" onClick="toggle('bhm');" name="USA" id="USA" />
    USA</a></li></div>
    <div id="uk"> <li><a href="#">
    <input type="checkbox" onClick="toggle('atlanta');" name="uk" id="uk" />
    UK</a></li></div>
    </ul>
    </li>
    <li class="current"> <a href="#">Location</a>
    <ul>
    <div id="atlanta"> <li><a href="#">
    <input type="checkbox" name="ilt" id="ilt" />
    <label for="ilt"></label>
    Atlanta</a></li></div>
    <div id="bhm"><li><a href="#">
    <input type="checkbox" name="rail" id="rail" />
    Birmingham
    </a></li></div>
    </ul>
    </body>
    /////////////////////////////////////////////////////////////

    in this toggle function is given to divs. In my original file, instead of divs there will be li tags ( <ul><li></li></ul> )

    i want to make this script work for li tags instead of divs.

    Thanks

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,038
    Thanks
    23
    Thanked 589 Times in 588 Posts
    Really not sure what you want. You have calls to javascript in an anchor??? You have a unordered list slightly wrong. Here with header, css, and JS calls (no anchors-<a> tags):
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <style type="text/css">
    ul{
    	list-style-type:none;
    }
    </style>
    </head>
    
    <body>
    <ul>
    <li>Region
    	<ul>
    		<input type="checkbox" onclick="toggle('uk');">
    		Americas
    	</ul>
    	<ul>
    		<input type="checkbox" onclick="toggle('usa');">
    		EMEA
    	</ul>
    	<ul>
    		<input type="checkbox" onclick="toggle('something');">
    		APJ
    	</ul>
    </li>
    
    <li>Country
    	<ul>
    	<input type="checkbox" onclick="toggle('bhm');">
    	USA
    	</ul>
    	<ul>
    	<input type="checkbox" onclick="toggle('atlanta');">
    	UK
    	</ul>
    </li>
    
    <li> Location
    	<ul>
    	<input type="checkbox" onclick="toggle('something');">
    	Atlanta
    	</ul>
    	<ul>
    	<input type="checkbox" onclick="toggle('something');">
    	Birmingham
    	</ul>
    </li>
    </ul>
    </body>
    </html>
    Evolution - The non-random survival of random variants.


  •  

    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
    •