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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnClick Fade In

Status
Not open for further replies.

grande

Programmer
Joined
Feb 14, 2005
Messages
657
Location
CA
This has got to be really easy, but for some reason it's giving me a lot of trouble.

Currently, when I mouse over an image, the image just changes. What I would like to happen is that the image will fade slowly (ie, over a period of 2 seconds). Here's how the page looks right now:

Code:
<HTML>

<HEAD>
<LINK HREF="styles.css" REL="stylesheet" TYPE="text/css">
</HEAD>

<BODY>

<script language="Javascript1.1">
<!--

	function yaImgChange(imgNum,imgSrc) {
	  document.images[img]um[/img].src = imgSrc;
	}
// -->
</script>

<CENTER>
<TABLE>
   <TR><TD><IMG NAME="Grande" SRC="Images/grande_band_bw.jpg" onMouseOver="yaImgChange('Grande', 'Images/grande_band.jpg');" onMouseOut="yaImgChange('Grande', 'Images/grande_band_bw.jpg');"></TD>
       <TD><IMG NAME="Trevor" SRC="Images/trevor_band_bw.jpg" onMouseOver="yaImgChange('Trevor', 'Images/trevor_band.jpg');" onMouseOut="yaImgChange('Trevor', 'Images/trevor_band_bw.jpg');"></TD></TR>
   <TR><TD><CENTER>Grande - Guitar</CENTER></TD>
       <TD><CENTER>Trevor - Vocals</CENTER></TD></TR>
   <TR><TD><IMG NAME="Shawn" SRC="Images/shawn_band_bw.jpg" onMouseOver="yaImgChange('Shawn', 'Images/shawn_band.jpg');" onMouseOut="yaImgChange('Shawn', 'Images/shawn_band_bw.jpg');"></TD>
       <TD><IMG NAME="Brandon" SRC="Images/brandon_band_bw.jpg" onMouseOver="yaImgChange('Brandon', 'Images/brandon_band.jpg');" onMouseOut="yaImgChange('Brandon', 'Images/brandon_band_bw.jpg');"></TD></TR>
   <TR><TD><CENTER>Shawn - Bass</CENTER></TD>
       <TD><CENTER>Brandon - Drums</CENTER></TD></TR>
</TABLE>

</CENTER>
</BODY>
</HTML>

Any help would be greatly appreciated.

-------------------------
Just call me Captain Awesome.
 
You will need to look at the opacity filters. You can put a solution together that will work for FF, IE, Opera and Safari that does this.

Take a look at the demo I have here that shows opacity being used in a similar way.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
I forgot to mention it before, but it's fading from Black & White to colour. Does that change anything? Is there another JavaScript function to do that?

-------------------------
Just call me Captain Awesome.
 
You mightn't be able to achieve what you want across every browser combination... but you ought to be able to apply an appropriate filter for the black+white to colour part which will work on IE Windows browsers... others may not necessarily get this... they ought to all be able to fade from 0% to 100%.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top