473,386 Members | 2,114 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,386 software developers and data experts.

FAQ-page => showing/hiding text

Hi,

I'm making a FAQ-page. To keep it a little synoptic, only the questions are
visible. When you klick on a certain question, the answer appears. You can
find an example at: http://www.aendekerk.be/zoom/uitklappen.htm

Suppose i click on "titel1", "tekst1" appears. When i click on "titel2",
"tekst2" appears. But also tekst1 remains visible. I don't want this. How
can i program this?

Thanks!

Dries
Jul 20 '05 #1
5 1217
Dré wrote on 09 feb 2004 in comp.lang.javascript:
I'm making a FAQ-page. To keep it a little synoptic, only the
questions are visible. When you klick on a certain question, the
answer appears. You can find an example at:
http://www.aendekerk.be/zoom/uitklappen.htm

Suppose i click on "titel1", "tekst1" appears. When i click on
"titel2", "tekst2" appears. But also tekst1 remains visible. I don't
want this. How can i program this?


function openen(x) {
s='none'
document.getElementById('text1').style.display=s
document.getElementById('text2').style.display=s
document.getElementById('text3').style.display=s
document.getElementById('text4').style.display=s
document.getElementById('text5').style.display=s

document.getElementById(x).style.display=''
}
<div onclick="openen('text1')">titel van text1</div>
<div id="text1">...........</div>

niet getest, hoor.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
Dré wrote:
Hi,

I'm making a FAQ-page. To keep it a little synoptic, only the questions are
visible. When you klick on a certain question, the answer appears. You can
find an example at: http://www.aendekerk.be/zoom/uitklappen.htm

Suppose i click on "titel1", "tekst1" appears. When i click on "titel2",
"tekst2" appears. But also tekst1 remains visible. I don't want this. How
can i program this?

Thanks!

Dries

Keep the ID of the opened question in a public variable, and on click of
an item first close the opened one.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Jul 20 '05 #3
> I'm making a FAQ-page. To keep it a little synoptic, only the questions are
visible. When you klick on a certain question, the answer appears. You can
find an example at: http://www.aendekerk.be/zoom/uitklappen.htm

Suppose i click on "titel1", "tekst1" appears. When i click on "titel2",
"tekst2" appears. But also tekst1 remains visible. I don't want this. How
can i program this?


I've found a solution on
http://www.dynamicdrive.com/dynamicindex1/navigate2.htm
Thanks anyway for replying!!

Dries

--
E-mail: dries <punt> aendekerk <ad> advalvas <punt> be

Jul 20 '05 #4
"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:c0***********@news2.solcon.nl...
<snip>
Keep the ID of the opened question in a public variable,
and on click of an item first close the opened one.


Rather than saving the ID of the element that needs to be re-hidden as a
string in a global variable it would be more efficient to save a
reference to the element, or, better yet, its style object. It would
save having to re-locate the element within the DOM (getElementById is
not necessarily that fast). The script must have had that reference when
it made the element visible so it can just assign the reference at that
point, having defaulted the global variable to null. Then if the
variable refers to an object when it is time to make a different element
visible it is a simple matter to first render the stored element hidden.

Richard.
Jul 20 '05 #5
Richard Cornford wrote:
"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
Keep the ID of the opened question in a public variable,
and on click of an item first close the opened one.
Rather than saving the ID of the element that needs to be re-hidden as a
string in a global variable it would be more efficient to save a
reference to the element, or, better yet, its style object.


Thanks. Showing my javascript age here :-)
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Fisher | last post by:
In a recent message, "Re: Two questions about...something", Fred H wrote: >> This is covered in the FAQ. Please read FAQ before posting. >> > I have read the FAQ, and I search it quite often....
0
by: Marshall Cline | last post by:
URL: http://www.parashift.com/c++-faq-lite/ Archive-name: C++-FAQ ============================================================================== Contents: Copying permissions...
21
by: Boris Ammerlaan | last post by:
This notice is posted about every week. I'll endeavor to use the same subject line so that those of you who have seen it can kill-file the subject; additionally, Supersedes: headers are used to...
6
by: Juan T. Llibre | last post by:
Welcome to the ASP.NET FAQ. The online version of this FAQ is at http://asp.net.do/faq/ Bookmark it! Thank you for reading this FAQ! Use it to improve your online experience. The Microsoft...
19
by: Dr John Stockton | last post by:
kelvlam <kelvlam@gmail.composted : The newsgroup FAQ has not been posted here for some considerable while. The latest version I know of is 8.1 - 2005-11-05 but I think the Web site serves...
7
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How can I access the client-side filesystem?...
56
by: jacob navia | last post by:
This is what is there now (2006, 20 Dec) How can I do serial (``comm'') port I/O? It's system-dependent. Under Unix, you typically open, read, and write a device file in /dev, and use the...
28
by: =?ISO-8859-15?Q?Juli=E1n?= Albo | last post by:
Hello. The welcome message of this group says: "The comp.lang.c++ FAQ is available at http://www.parashift.com/c++-faq-lite/" However, nothing in that FAQ mentions that is FAQ of this...
20
by: FAQEditor | last post by:
FAQ Version 9.86 Dated 2007-10-03 has been uploaded. Most changes are cosmetic and some typo corrections. -- Randy comp.lang.javascript FAQ - http://jibbering.com/faq/index.html FAQ Notes:...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.