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

    Can't get ElementById to work!

    I can't seem to get this Javascript to work:

    <script type="text/javascript">
    if (cfsc_user == true) {
    document.getElementById("mf1").style.display="none";
    }
    else {
    document.getElementById("mf1").style.display="block";
    }
    </script>

    I am giving the tables Ids like <table id="mf1">. But for some reason it is not hiding the table from the cfsc users. It is still displaying. Just so you know, elsewhere on the page is a script that sniffs if the user is "cfsc" or not already. Do I still have to assign a function or variable to this? This is my first time coding to hide certain things from certain users so I am a bit confused on what the proper syntax is. I looked online before posting but couldn't find a proper example of what I am trying to do.

    Can anybody hellp? Thanks.
    Kevin

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Post the rest of your code please.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is my first time coding to hide certain things from certain users
    Be aware of security issue as JS is visible to ALL users.
    rm -f /


  •  

    Posting Permissions

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