This is a discussion on "Question about swapping text" within the JavaScript Forum section. This forum, and the thread "Question about swapping text are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Question about swapping text
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Question about swapping text
I'm trying to set up a series of questions, which would look basically like an unordered list. Then, upon clicking a box next to any of the questions, the answer would appear underneath the question. Clicking that same box a second time would cause the answer to disappear. It seems very simple, and I've tried using a couple of different text swapping functions, but for some reason I can't get the answer text to appear in the right places. The script seems to have a hard time keeping track of where things are supposed to go, and it's really irritating me. I need to find a solution ASAP. Thanks!
|
|
|
|
#2
|
||||
|
||||
|
Re: Question about swapping text
I wrote this a while back for someone with the same question. I upgraded it a little so it won't stop the script if there is no "questions" id. It degrades nicely too. If the user doen't have JavaScript enabled, the questions won't be links and the answers will be visible.
The javascript:
Last edited by Ryan Fait; Sep 19th, 2006 at 02:00. |
|
#3
|
||||
|
||||
|
Re: Question about swapping text
I just realized: the only bad thing about this is you can only have one definition list because it has an ID. I could modify it if you need it to support multiple lists, though.
|
![]() |
| Tags |
| question, swapping, text |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Swapping script | Izkoo | JavaScript Forum | 3 | Jun 7th, 2008 20:13 |
| show/hide divs swapping - a bit of interactivity | benreynolds4 | JavaScript Forum | 1 | May 29th, 2008 09:06 |
| Question about anchor text | belock1980 | Starting Out | 3 | Apr 17th, 2008 16:36 |
| Link Anchor Text Question | fireboat | Search Engine Optimization (SEO) | 5 | Sep 11th, 2007 06:10 |
| Link Swapping Practice | Lchad | Webforumz Cafe | 4 | Jun 27th, 2007 20:13 |