View Full Version : what did i do wrong?

06-15-2011, 05:57 AM
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.

#show{CSS code}
#menuDet1{CSS code and visibility:hidden;}

I then had in html

<div id="show" onmouseover="changevis(1)"></div>
<div id="me1"></div>

and then a function

function changevis(index){
acMenuDet="me" + index;

a colleague of mine helped me "debug" this until it worked and we came up with

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

<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?

06-15-2011, 08:19 AM
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

06-15-2011, 08:54 PM
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