Forum Moderators: open

Message Too Old, No Replies

not sure why my simple js won't work.

trying to make a hidden div show on mouseover

         

cuce

3:25 pm on Aug 14, 2007 (gmt 0)

10+ Year Member



Here's my code, it's very simple, but for some reason I get stay is not defined. I'm simply trying to show a hiding div on mouseover.

js:
---
function feat(thediv){
var jumpee = document.getElementById(thediv);
jumpee.style.display = 'block';
}

function defeat(thediv){
if (document.getElementById(thediv))
{
var unjumpee = document.getElementById(thediv);
unjumpee.style.display = 'none';
}
}

html:
-----
<img src="whatever.gif" alt="whatever" onmouseover="feat(stay);">
<div id="stay">I am the hidden div</div>

can someone please tell me what I've done wrong?
I'm really new at this.
Thanks

Alternative Future

3:31 pm on Aug 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hi Cuce,

Try putting your variable id in quotes like:
onmouseover="feat('stay');">

Then that should work

-Gs

cuce

4:04 pm on Aug 14, 2007 (gmt 0)

10+ Year Member



Thanks so much! I figured it was something basic like that!