Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help! Toggle CSS visibility JS?

Help! Toggle CSS visibility JS?
Thread Tools
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 9, 2004, 08:42 AM
 
Hi,

I'm trying to ceate a Javascript that will toggle a classes visibility. i.e. an objects contents will hide it's self or make it's self visible on clicking a link.

Anyone have any idea how I might go about this or refer me to a reference that might help.

Thanks!
     
Grizzled Veteran
Join Date: Nov 2003
Location: Hebburn, UK
Status: Offline
Reply With Quote
Jun 9, 2004, 09:45 AM
 
document.getElementById("the_element_id").style.vi sibility = "hidden";

use "visible" to make it visible...

however, you mentioned a class - so is this for a bunch of objects all with the same class? If so, you can modify the CSSStyleRule that's relevant.
Just who are Britain? What do they? Who is them? And why?

Formerly Black Book
     
Fresh-Faced Recruit
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jun 9, 2004, 10:31 AM
 
Code:
<script language="JavaScript" type="text/JavaScript"> <!-- function toggle() { if (document.getElementById("popup").style.visibility == "hidden") { document.getElementById("popup").style.visibility = "visible"; } else { document.getElementById("popup").style.visibility = "hidden"; } } //--> </script> <a href="javascript:toggle();">toggle</a> <div id="popup">hello</div>
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 9, 2004, 03:31 PM
 
Actually, I'm going to need some sort of array, so I can hide one object and show another.

Something like this I guess:

var pcount = 1;
function goNext(oneClicked,class1,class2) {
if (oneClicked=="prev") {
if (pcount==1) {
alert("This is the first part.")
}
else {
pcount = --pcount;
}
}
else {
if (pcount==2) {
alert("This is the last part.")
}
else {
pcount = ++pcount;
}
}
switch (pcount) {
case 1 :
p1.className = class1;
p2.className = class2;
break;
case 2 :
p1.className = class2
p2.className = class1;
break;
}
}
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 9, 2004, 03:32 PM
 
Actually, I'm going to need some sort of array, so I can hide one object and show another.

Something like this I guess:

var pcount = 1;
function goNext(oneClicked,class1,class2) {
if (oneClicked=="prev") {
if (pcount==1) {
alert("This is the first part.")
}
else {
pcount = --pcount;
}
}
else {
if (pcount==2) {
alert("This is the last part.")
}
else {
pcount = ++pcount;
}
}
switch (pcount) {
case 1 :
p1.className = class1;
p2.className = class2;
break;
case 2 :
p1.className = class2
p2.className = class1;
break;
}
}

Except this doesn't work with Netscape (Gecko):
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 9, 2004, 04:15 PM
 
Here's what I'm trying to do:

http://home.earthlink.net/~headbirth...ng/index2.html

I want to be able to click on the Identity Design Type and havee the top 4 rows hide and show 4 new ones. I have some code in place that does this, but it doesn't work with netscape.

Any help would be appreciated ..
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jun 10, 2004, 08:51 AM
 
I think these are the actions I'm trying to accomplish:

Toggle CSS Visibility for:

Hide Intro page and reveal Navbar and Case Studies page

Show/Hide Identity Design Sets 1 & 2
Show/Hide Publishing Design Sets 1 & 2

Show News blog and hide Case Studies
Show Case Studies and hide News page
Show Contact page and hide News and Case Studies page

Viewer:
clicking on a case study hides case study and shows item plus inserts an image into the cell based on what item was clicked ...

Navbar remove/deactivate or insert an items link depending on a click.

Resonable? :-)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2