To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-10-2006, 12:02 PM   #1
kbc1
Senior Member
 
Join Date: Nov 2005
Posts: 235
Expanding/Collapsing Menu

Hi,

I have a menu which via the use of Javascript and css, expands and collapses and displays the menu options as you would expect. My menu is a separate php page and I include it in all of my other web pages.

The problem I am having is that when I expand the menu and choose an option, the page is posted/refreshed and the menu collapses again. I need the menu to stay open as you would expect to see being a user.

Here is my PHP menu code:

PHP Code:

// get the top level navigation options from the database    
    
$topsqlquery = "SELECT my top level Menu Items";
    
$topresult = mysql_query($topsqlquery);
    while (
$datarow = mysql_fetch_array($topresult)) {
        
$eventid = $datarow['eventid'];
        
$navtitle = $datarow['navtitle'];
    
        
// this bit displays the top level links and when you click the link, it uses javascript to display the
        // DIV below in either BLOCK or NONE css style
        
echo "    <div id=\"eventgroup$eventid\" class=\"toplevelnav\">
                    <a title=
\"Click to view events\" href=\"javascript: tccShowEvents($eventid);\">$navtitle</a>
                </div>"
;

        
// by default, this DIV is hidden and the above javascript displays it appropriatley
        
echo "     <div id=\"eventlist$eventid\" class=\"eventitem\">";        

            
$subsqlquery = "SELECT my sub level menu items WHERE they link to the Top Level Menu Items";
            
$subdataresult = mysql_query($subsqlquery);
            
$subcount = mysql_num_rows($subdataresult);
            while (
$evdatarow = mysql_fetch_array($subdataresult)) {
                
$sid = $evdatarow['sid'];
                
$subtitle = $evdatarow['subtitle'];
                
$suburl = $evdatarow['suburl'];

                echo
"    <div id=\"singleevent$sid\" class=\"evdesc\"><a href=\"eventdetails.php?nid=$eventid&sid=$sid\">$subtitle</a></div>\n";
            }
            
mysql_free_result($subdataresult);
        
        echo
"<a title=\"Click to close list\" href=\"javascript: tccHideEventDetails($eventid);\"><p style=\"color:#003366\">close menu</p></a>";
        echo
"</div>";
    
    }
    
mysql_free_result($topresult);


Any advice would be greatly appreciated.

Thanks.
kbc1 is offline   Reply With Quote
Old 03-10-2006, 02:42 PM   #2
gardnc
Blueridger
 
Join Date: Nov 2004
Location: Sylva, NC USA
Posts: 201
We finally resolved the same problem by putting the menu in it's own frame and only refreshing a content frame.
gardnc is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:21 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.