Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2008, 03:04 PM
Member
 
Join Date: Apr 2008
Posts: 1
LWCARAB is on a distinguished road
Collapse all Divs
Hello,

I have some code which enables me to collapse and expand divs, I have got it to do what I want it to do in my html page but I now need a button that collapse all the expanded divs and have no idea where to start. Can anyone help? I've attached the html, css and js files.

Regards,

Richard
Attached Files
File Type: zip aw@rdonline.zip (3.5 KB, 0 views)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-15-2008, 07:42 PM
bobleny's Avatar
Member
 
Join Date: Apr 2008
Posts: 36
bobleny is on a distinguished road
I have three pieces of advice for you,
First and foremost: This is a Java forum, not a JavaScript forum. Java vs. JavaScript

Second, there are a lot of people like me, who won't download a zip file from a forum. I think it is a bad Idea.... So, it is best to simply place your code in the "code boxes" (Much like I have bellow). That makes it easier on the people who want to help you, which is a good thing.

Third, so as not to sound like a mean and bitter old man, you use this code to collapse a <div> tag in javascript:
Code:
document.getElementById(id).style.display = "none";
Where "id" is the id of the div tag you'd like to collapse. It simply tells the browser to hid the div tag, thus it disappears...

You can initiate this with the onclick command.
Code:
onclick="SomeFunction(id)"
Where "SomeFunction" calls the function that will collapse the div tag and "id" is the id of the div tag you'd like to collapse.

The function might look something like this:
Code:
function SomeFunction(id) { document.getElementById(id).style.display = "none"; }
Each id must be unique!
__________________
--
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
--
Cheer up, the worst has yet to come...

Last edited by bobleny : 04-15-2008 at 07:57 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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



All times are GMT +3. The time now is 07:40 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org