JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old March 18th, 2003, 01:54 PM
jonpass jonpass is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: South East England
Posts: 10 jonpass User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
having the Internet only expanding menu start off collapsed problems?????

hi i have been playing around with the collapsing menu off this site found Here
ive just changed the sql query to fit in with my data base. but the problem i am having is that the menu starts off all expanded but i want it to start off coollapsed.
i tried putting in an onload function to change it as soon as it loads but when it loads for the second time it calls the onload function etc.. never ending circle..

any ideas i dont use javascript much

regards

jon

ps here is the code i have so far

PHP Code:
<?php

    
// Create our database connection
    
$sqlConn mysql_connect("localhost""root""HJ34Rtf") or die("Couldn't connect to database");
    
$dbConn mysql_select_db("compsci"$sqlConn) or die("Couldn't connect to database");
    
    
//set up 
    
$sql "select Distinct staff.StaffCode, tutors.TutorID
    from staff, tutors, students
    where staff.StaffID = tutors.StaffID
    and students.TutorID = tutors.TutorID
    and students.Year >= 11
        order by StaffCode ASC;"
;
    
$nodeResult mysql_query($sql) or die("SELECT query failed"mysql_error());
    
$counter 0;
    
?>

<html>
<head>
<title> Dynamic Menus </title>
<style>

    .root_td
    {
      background-color: #000000;
      color: #FFCF00;
      font-family: Verdana;
      font-size: 8pt;
      font-weight: bold;
      height: 22;
      padding-left: 5;
    }

    .child_td
    {
      background-color: #D1D1D1;
      color: #000000;
      font-family: Verdana;
      font-size: 8pt;
      font-weight: bold;
      text-decoration: underline;
      height: 22;
      padding-left: 10;
      padding-right: 10;
      padding-bottom: 3;
    }
    
    body
    {
      color: #000000;
      font-family: Verdana;
      font-size: 8pt;
      font-weight: normal;
    }
    
    a
    {
      color: #000000;
    }

</style>
<script language="JavaScript">

    function ToggleNode(nodeObject, imgObject)
        {
            if(nodeObject.style.display == '' || nodeObject.style.display == 'inline')
                {
                    nodeObject.style.display = 'none';
                    imgObject.src = 'plus.gif';                    
                }
            else
                {
                    nodeObject.style.display = 'inline';
                    imgObject.src = 'minus.gif';
                }
        }

</script>
</head>
<body bgcolor="#FFFFFF">

    <table width="250" border="0" cellspacing="0" cellpadding="0">
    <?php
    
        
while($node mysql_fetch_array($nodeResult))
            {    
    
?>
        <tr>
            <td class="root_td">
                <img id="img_root_<?php echo $counter?>" onClick="ToggleNode(td_root_<?php echo $counter?>, img_root_<?php echo $counter?>)" border="0" src="minus.gif">
                &nbsp;<?php echo $node[0]; ?>
            </td>
        </tr>
        <tr>
            <td id="td_root_<?php echo $counter++; ?>" class="child_td">
                <table width="100%">
                    <?php
                    
                        $sql 
"select * from Students where TutorID = {$node[1]} order by Forename asc";
                        @
$childResult mysql_query($sql);
                        
                        while(
$child mysql_fetch_row($childResult))
                            {
                        
?>
                    <tr>
                        <td class="child_td">
                            <a href="<?php echo $child[2]; ?>"><?php echo "$child[1] $child[2]"?></a>
                        </td>
                    </tr>
                    
                    <?php
                        
}
                    
?>
                    
                </table>
            </td>
        </tr>
    
    <?php
        
}
    
?>
    
    </table>

</body>
</html>

Reply With Quote
  #2  
Old March 18th, 2003, 05:11 PM
jonpass jonpass is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: South East England
Posts: 10 jonpass User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Smile Sorted It

just added style="display: none" to the td tag so

<td id="td_root_<?php echo $counter++; ?>" class="child_td">


goes to


<td id="td_root_<?php echo $counter++; ?>" class="child_td" style="display: none">

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > having the Internet only expanding menu start off collapsed problems?????


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway