Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 18th, 2003, 05:00 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default sliding menus

Hi there

I've created this sliding menu on my page - i.e when you click on a category, the sub categories become visible below. However, when I click on another category I want the sub categories from the previous category to disappear, but they don't. Can anyone tell me how to alter my code to reflect this? Here's the bare bones of my code:

<script language="JavaScript" type="text/JavaScript">
// Quick browser check !
ie4 = (document.all) ? true : false;

function showAll(targetId, id2, id3){
    if (ie4){

        target = document.all(targetId);
        id2 = document.all(id2);
        id3 = document.all(id3);

        if (target.style.display == "none"){
            target.style.display = "";
        } else {
            target.style.display = "none";
        }

        if (id2.style.display == ""){
            id2.style.display = "none";
        }

        if (id3.style.display == ""){
            id3.style.display = "none";
        }


    }//End If
    else {
    document.location = "?PortfolioID=" + targetId
    }
}
</script>

 <img src="image_bin/arrow.gif" width="9" height="9" />&nbsp;&nbsp;<a href="javascript:showAll('COMM')" title="Entertainment"><%=rsDiv("Division")%></a>

 <img src="image_bin/arrow.gif" width="9" height="9" />&nbsp;&nbsp;<a href="javascript:showAll('ENT')" title="Commercial"><%=rsDiv("Division")%></a>

 <img src="image_bin/arrow.gif" width="9" height="9" />&nbsp;&nbsp;<a href="javascript:showAll('EDU')" title="Commercial"><%=rsDiv("Division")%></a>


<tr id="COMM" style="display:none">

<tr id="EDU" style="display:none">

<tr id="ENT" style="display:none">


Many thanks

Adam
 
Old November 18th, 2003, 06:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

At the moment, the function showAll takes 3 args, but you're only passing 1. Don't you need to also pass the ids of the menus you want to make invisible as args 2 and 3?
 
Old November 18th, 2003, 08:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Hi Phil

Even if I do pass all 3, it returns the same results for me. Any ideas/

thanks

Adam
 
Old November 18th, 2003, 09:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Stop, stop, stop! It works now - damn, these things sometimes seem to have a mind of their own!

thanks Phil





Similar Threads
Thread Thread Starter Forum Replies Last Post
Sliding Bar scandalous Access 1 February 8th, 2007 01:04 PM
HTML menus BrendonMelville HTML Code Clinic 3 March 14th, 2006 10:51 AM
sub menus matshediso HTML Code Clinic 2 January 31st, 2005 05:15 AM
Sliding forms iniro VB.NET 2002/2003 Basics 1 December 22nd, 2004 07:57 AM
Menus Frank Schmuck BOOK: Beginning ASP.NET 1.0 1 June 6th, 2003 01:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.