473,385 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

collapsible text

hi
im a complete novice at javascript and i am trying to add some collapsible
text into my website! I want to hide pieces of text behind headlines so they can be clicked on and be reveiled, if anyone has some script for this i would be
very gratefull!!
May 2 '07 #1
3 3359
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

To have collapsible text
1. Have a div or span with the display set to 'block', e.g.
[HTML]<div id="aDiv" style="display:block">Text</div>[/HTML]
2. Then add an onclick event handler to the element that will toggle the display of the text:
Expand|Select|Wrap|Line Numbers
  1. onclick="toggleDisplay()"
3. Then in the function:
Expand|Select|Wrap|Line Numbers
  1. function toggleDisplay () {
  2.  var div = document.getElementById('aDiv');
  3.  if (div.style.display=='block') div.style.display = 'none';
  4.  else div.style.display = 'block';
  5. }
If you have any problems, post your code.
May 2 '07 #2
How would I make the script so that the text defaults as hidden then shows on the click? At the moment it defaults as being shown then hides with a click.
robskinn
Aug 14 '07 #3
epots9
1,351 Expert 1GB
How would I make the script so that the text defaults as hidden then shows on the click? At the moment it defaults as being shown then hides with a click.
robskinn
like this:
[html]
<div id="aDiv" style="display:none">Text</div>
[/html]
Aug 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: clintonG | last post by:
Can somebody direct me to documents or source that supports the use of collapsible content that is collapsed by default when the page is loaded? The secondary objective would of course be...
1
by: mike | last post by:
The JavaScript below works fine for expandable/collapsible menus in IE, but Firefox 1.5 complains: "Error: loc.parentNode.nextSibling has no properties" and highlights the line...
5
by: Jonathan | last post by:
Hello All, I am in the process of creating a 2/3 level collapsible/exspanible menu (called "nav") where users can click on a category and have the submenus appear beneath it and so on (allow...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
2
by: probashi | last post by:
Hi, I have couple of AJAX collapsible panels in one of my page. I would like the page to remember the state of the panel (is Expended ) property (i.e. user comes to my page and expands a panel...
1
by: mahesh123 | last post by:
I am using Collapsible Panel in my project.But in other form of my project i want to use collapsible panel inside other Collapsible panel.Is it possible. Both panels are to be dinamic.Is it possible...
0
by: =?Utf-8?B?R2lvcmdpbw==?= | last post by:
Hi, I am having a problem and I need some help. I have a listview with a collapsible panel that has a updatepanel and listview inside updatepanel and I have a button that triggers the...
0
by: wojski696969 | last post by:
Hi.. I'm using ASP.NET AJAX Control Toolkit. I've got collapsible extender (CE) putted inside of modal popup extender (MPE), and there is a problem if i scroll the page when collapsible area is...
5
by: veenna | last post by:
i have a grid inside a collapsible panel in my page. on expand of collapsible panel i want to bind data to grid. how can i do this? how to get the events of collapsible panel. please help ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.