Help - Search - Members - Calendar
Full Version: Make a div disappear on mouseover, restore on mouseout
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
LCMSguy
Before I ask this question, let me say that while I am a programmer, I'm rather new to web design as a whole. JavaScript and related functions I understand; CSS and markup are utterly alien to me. I will therefore not be offended if you answer me as if I were five years old.

I have a fixed-position div containing an image. I need that image to disappear on mouseover (that mouseover can be the image or the div itself, since the image is the only thing in the div), and reappear on mouseout. Using FrontPage, I have tried:
CODE
<div style=[stuff]onmouseout="FP_changePropRestore()" onmouseover="FP_changeProp(/*id*/'img1',1,'style.display','none')">.
I have also tried that same code with "visibility:hidden" instead of "display:none". When I use this code, I get a "flicker" effect when the mouse is moved over the div; I assume this is caused by the disappearance of the image triggering the mouseout condition.

So, any suggestions? Please remember, I'm a newbie at web design, so be kind and take it step by step for me. Your help is greatly appreciated!
ericditmer
Try this, obviously replacing the Google logo with your image. tongue.gif
CODE
<div id="test" name="test" onmouseover="document.getElementById('test_image').style.visibility= 'hidden';" onmouseout="document.getElementById('test_image').style.visibility= 'visible'">
<img src="http://www.google.com/intl/en_ALL/images/logo.gif" id="test_image">
</div>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.