Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Help with collapseing tables
Old 07-11-2008, 08:12 PM Help with collapseing tables
Super Talker

Posts: 135
Trades: 0
Hello everyone, this is my first post. I actually got this code from a member here, Christopher i beleive is his name. Im having some trouble.

Id simply like to change it so that by default all everything is collapsed and taking up as little space as possible. Right now everything is expanded by default and i know almost nothing about coding. I managed to modify the code to add another collapsible menu...took a while to figure it out.

Heres the code;

Code:
<html>
<head>
    <title> New Document </title>
    <script language="javascript">
    function getItem(id)
    {
        var itm = false;
        if(document.getElementById)
            itm = document.getElementById(id);
        else if(document.all)
            itm = document.all[id];
        else if(document.layers)
            itm = document.layers[id];
        return itm;
    }
    function toggleItem(id)
    {
        itm = getItem(id);
        if(!itm)
            return false;
        if(itm.style.display == 'none')
            itm.style.display = '';
        else
            itm.style.display = 'none';
        return false;
    }
    </script>
</head>
<body>
<table width="400">
    <tbody>
        <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbody')">Ford Bronco</a></td></tr>
    </tbody>
    <tbody id="myTbody">
        <tr><td>Engine 1</td></tr>
        <tr><td>Engine 2</td></tr>
        <tr><td>Engine 3</td></tr>
        <tr><td>Test row4</td></tr>
        <tr><td>Test row5</td></tr>
    </tbody>
</table>
</body>
</html>__________________
<html>
<head>
    <title> New Document </title>
    <script language="javascript">
    function getItem(id)
    {
        var itm1 = false;
        if(document.getElementById)
            itm1 = document.getElementById(id);
        else if(document.all)
            itm1 = document.all[id];
        else if(document.layers)
            itm1 = document.layers[id];
        return itm1;
    }
    function toggleItem(id)
    {
        itm1 = getItem(id);
        if(!itm1)
            return false;
        if(itm1.style.display == 'none')
            itm1.style.display = '';
        else
            itm1.style.display = 'none';
        return false;
    }
    </script>
</head>
<body>
<table width="400">
    <tbody>
        <tr><td style="background-color: #CCC"><a href="#" onclick="toggleItem('myTbody1')">Ford F-150</a></td></tr>
    </tbody>
    <tbody id="myTbody1">
        <tr><td>Engine 1</td></tr>
        <tr><td>Engine 2</td></tr>
        <tr><td>Engine 3</td></tr>
        <tr><td>Test row4</td></tr>
        <tr><td>Test row5</td></tr>
    </tbody>
</table>
</body>
</html>__________________
Thanks for the help.
CompTronicsTec is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-12-2008, 05:57 PM Re: Help with collapseing tables
Super Talker

Posts: 135
Trades: 0
Common guys, 50 veiws and not one response. Im sure that what im asking isnt impossible i just dont have the personal knowlege to do it.

All i need to do is make the tables collapsed by default instead of all expanded by default, please help.
CompTronicsTec is offline
Reply With Quote
View Public Profile
 
Old 07-12-2008, 07:06 PM Re: Help with collapseing tables
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Maybe you should ask a mod to move this to the correct forum.
joder is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help with collapseing tables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.71395 seconds with 12 queries