homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Other Geeky Stuff   » Ask a Geek!   » Javascript help

 - UBBFriend: Email this page to someone!    
Author Topic: Javascript help
Titanium Warrior
Alpha Geek
Member # 1885

Member Rated:
4
Icon 1 posted September 28, 2006 22:49      Profile for Titanium Warrior   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Hi guys... looking for a little help... trying to make an expanding/collapsing text box, and I have a link that can expand and collapse it, but I also wanted to add another collapse link the actual expanded box.

The example can be found here http://www.columbiafuels.com/bio_heat_myths.htm

There isn't anything actually wrong with it, it's just that I've added a second link to collapse the box, but I wanted to make both links switch from 'close' back to 'expand'

-TiW

--------------------
I used to have super powers until my therapist took them away.

Posts: 333 | From: Victoria, BC Canada | Registered: Dec 2002  |  IP: Logged
Jace Raven

Solid Nitrozanium SuperFan!
Member # 2444

Member Rated:
5
Icon 1 posted September 29, 2006 00:57      Profile for Jace Raven   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
scrap the javascript in this case. Use CSS.
Posts: 1791 | From: Seoul, Korea | Registered: Nov 2003  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted September 29, 2006 08:22      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by Jace Raven:
scrap the javascript in this case. Use CSS.

Wrong answer. CSS cannot readily do what he's asking for. I might say that it's a kind of ugly thing to do, but if that's the client request, so be it.

Unfortunately, I can't really look at it in depth right now - basically, you need to have a single function that is passed parameters, which changes the text of *both* links upon clicking it. Currently, it's very broken, as if you toggle via different buttons, it sort of works, but looks funky.

Think along the lines of:
function toggle_section(section_name)

Then, have appropriately IDed sections and links, such that a simple function can get the elements and alter them accordingly.

The *most* important part is that you put everything in tidy DIVs with links that work. Ideally, I'd suggest that it degrades gracefully to showing everything, and maybe have the links go to a 'more info' page. This way someone with Javascript disabled...or a screen reader, stands a better chance of getting at your information.

Get this extension, and learn to use it to the fullest:
http://chrispederick.com/work/webdeveloper/

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9204 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
Titanium Warrior
Alpha Geek
Member # 1885

Member Rated:
4
Icon 1 posted September 29, 2006 08:39      Profile for Titanium Warrior   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
Thanks... I took a different approach and I like the results better now. Thanks D-man, you gave me some thought starters and then I took a different approach that works great.

Cheers
-TiW

--------------------
I used to have super powers until my therapist took them away.

Posts: 333 | From: Victoria, BC Canada | Registered: Dec 2002  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

© 2014 Geek Culture® All Rights Reserved.

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam