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 4 of 4

Thread: Something silly

  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Something silly

    Hi all,

    Making a mess of this, simple problem... Help!!


    Code:
    function MakeVis(MenuID) {
    alert(MenuID);
    document.write(MenuID)
    document.all.MenuID.style.visibility="visible";
    }
    document.write(MenuID) produces the text "Menu1"
    Now I know MenuID is a variable and I want to reflect this in the document.all line but Its just not happening. What am I doing wrong?
    Last edited by -Stu-; 10-24-2005 at 11:22 AM.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    a lot of things are wrong.

    I guess that you wanted to do something like this

    function MakeVis(MenuID){
    document.getElementById(MenuId).style.visibility='visible';
    }

    Anyway, can we see the whole code? What is your final purpose?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That is all the code

    All sorted now anyway. Sorry for the trouble, Hadn't woken up yet. Thanks for the reply though.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    document.all is an IE only reference. I strongly advice you to use
    document.getElementById(someid) instead
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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