JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



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:
  #1  
Old March 18th, 2003, 01:54 PM
jonpass jonpass is offline
Registered User
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
Registered User
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?????


Developer Shed Advertisers and Affiliates


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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap