Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to add fade in/out effect to a small div show/hide script

Status
Not open for further replies.

orion846

Programmer
Mar 3, 2008
2
US
hi guys,

i'm trying to get a div to fade in and fade out on image mouseover/mouseout, the below code is working for purposes of show/hide the div, but it's instant, and i cannot figure out how to fade. i'm very new to javascript. greatly appreciate any help someone can give me :)

the following is my code in header:

<script type="text/javascript" language="JavaScript">
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
</script>

the following is my code at the image:

<a onmouseover="ReverseContentDisplay('uniquename'); return true;" onmouseout="javascript:ReverseContentDisplay('uniquename')"><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/layout3_19.gif" /></a></td>

the following is the code at my div:

<div id="uniquename" style="display:none;">
Content goes here.
</div>
 
i'm not really willing to fill out and submit that form, and i cannot see any fading on the available pages pre-form submission
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top