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
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts

    what did i do wrong?

    first- i wanted to say (for all those who see it before the Mods remove it) how stupid does a bot have to be to set its spam to be resolved at OP? lol
    so now my question...
    I have two divs with some styling.
    Code:
    #show{CSS code}
    #menuDet1{CSS code and visibility:hidden;}
    I then had in html

    Code:
    <div id="show" onmouseover="changevis(1)"></div>
    <div id="me1"></div>
    and then a function
    Code:
    function changevis(index){
    acMenuDet="me" + index;
    document.getElementById(acMenuDet).visibility="visible";
    }
    a colleague of mine helped me "debug" this until it worked and we came up with

    Code:
    function details_visible(index) {
                var acMenuDet = "menuDet" + index;
                document.getElementById(acMenuDet).style.visibility = "visible";
                ;
            }
            function details_hidden(index) {
                var acMenuDet = "menuDet" + index;
                document.getElementById(acMenuDet).style.visibility = "hidden";
                ;
            }
    Note: also changed code in div to

    Code:
    <div id="show" onmouseover="details_visible(1)" onmouseout="details_hidden(1)"> Hover over me</div>
    <div id="menuDet1" style="visibility: hidden;" >Plesam Plesam Plesam Plesam Plesam</div>
    I do not see off the bat what I was doing wrong- anyone else see what I did incorrectly?

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,398
    Thanks
    12
    Thanked 570 Times in 563 Posts
    Your CSS was for an element with id 'menuDet1' but in your HTML the DIV had an id of 'me1'

    Then you used .visibility instead of .style.visibility

    Btw. you can remove those dangling semicolons at the end of each function

  • #3
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,742
    Thanks
    41
    Thanked 191 Times in 190 Posts
    ok thanx- i guess i missed a "." - the 'me1' area was an oopse bc in trying to debug it we didnt want to change my original function so we were playing w/ a new one and changed the names of the divs as opposed to the functions. the names were matching up before :P

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Posting Permissions

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