Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combining If/Else with doc.write w/ Hidden/Visible - Possible?

    I need to comine and if / else statement with a hidden / visible statement but not sure how you do it.

    My problem is so:
    I have members and non-members coming into a site. I want certain tables of information to be hidden for non-members and visible for members. I am not sure of the syntax for combining if/else - doc.write and hidden/visible. Can someone help?

    an example:
    <script type="text/javascript">
    if (cbol_user == 'true')
    {
    document.write("tell it show a table here")
    }
    else
    {
    *Tell it to hide the table here*
    }
    </script>

    I am not sure how you add hidden and visible variable to this. Can someone help me on this. This is the first time I have encountered someone asking for such a combination.

    Thanks.

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <script type="text/javascript">
    /* Code to check for user here */
    
    if(user)
    document.getElementById("tableid").style.display="block";
    else
    document.getElementById("tableid").style.display="none";
    </script>
    Doesn't get simpler then that

  • #3
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combining if else with hidden visible

    Thanks! I thought it was more complicated than that which is probably why I got stuck on it.

    Cheers!

    K


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •