Yeah I know and I am looking into it.
Will let you know the outcome.

Thanks for the assistance

>>> [EMAIL PROTECTED] 03/25/03 01:03PM >>>
I know there is a dynamic way to do this, and it is not very hard but I
dont
have time right now to get too deep into it.

-----Original Message-----
From: John Stanley 
Sent: Tuesday, March 25, 2003 1:02 PM
To: CF-Community
Subject: RE: Collapse Table


Does this work?

function toggle_fields(tbl_name){
        if (tbl_name == "TableA"){
                if (document.all.TableA.style.display == "none"){
                        document.all.TableA.style.display = "";
                }
                else{
                        document.all.TableA.style.display = "none";
                }
        }
}

this sould work, then you can just append the if with whatever other
tables
there are.


-----Original Message-----
From: Randell B Adkins [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 12:03 PM
To: CF-Community
Subject: RE: Collapse Table


I receive the error:
style.display is null or not an object.

I am calling it on an OnClick event:
onClick="toggle_fields('TableA');"

With the function:
function toggle_fields(tbl_name){
                var the_object = "document.all." + tbl_name;
                if (the_object.style.display == "none"){
                        the_object.style.display = "";
                }
                else{
                        the_object.style.display = "none";
                }
        }

>>> [EMAIL PROTECTED] 03/25/03 11:49AM >>>
what about this:
function toggle_fields(tbl_name){
        var the_object = "document.all." + tbl_name;
                if (the_object.style.display == "none"){
                        the_object.style.display = "";
                }
                else{
                        the_object.style.display = "none";
                }
        }

I'm pretty sure js will evaulate the property of the object without
you
having to explicity tell it to do that. But I have not tested this
method in
a while.



-----Original Message-----
From: Randell B Adkins [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 11:44 AM
To: CF-Community
Subject: RE: Collapse Table


That was simple enough.
How can I pass a dynamic name to the function?
Do not think that is right, but working on it.

onClick="toggle_fields('tableA');"

function toggle_fields(tbl_name){
                if (document.all.[tbl_name].style.display == "none"){
                        document.all.[tbl_name].style.display = "";
                }
                else{
                        document.all.[tbl_name].style.display = "none";
                }
        }



>>> [EMAIL PROTECTED] 03/25/03 11:33AM >>>
>>1. Make sure that the table you want to close/open has a unique
name.

like <table id="fields">

-----Original Message-----
From: John Stanley 
Sent: Tuesday, March 25, 2003 11:31 AM
To: CF-Community
Subject: RE: Collapse Table


Sure,
1. Make sure that the table you want to close/open has a unique name.
2. Set the style="display: " to either none or empty_string (nothing)
depending on how you want the table to display initially.
3. Create a js function like the following:
function toggle_fields(){
                if (document.all.fields.style.display == "none"){
                        document.all.fields.style.display = "";
                }
                else{
                        document.all.fields.style.display = "none";
                }
        }

4. Have your button or whatever call this function on it's onClick
event.

that should do it.

-----Original Message-----
From: Randell B Adkins [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 25, 2003 11:04 AM
To: CF-Community
Subject: Collapse Table


Does anyone know how to use JS to close table contents?

I have a few tables within a main table. If I click on
Close Table A, then Table A is closed but the rest 
remains shown. However a button should now show
to re-display Table A.

Any references anyone has to this is greatly appreciated.










~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5
                                

Reply via email to