Highlighting Image on Mouseover using Java script

Highlighting Image on Mouseover using Java script

We can highlight our images in web site by using the following JavaScript code between HEAD tags:

<SCRIPT language=”JavaScript”>
function makevisible_fn(cur,which){
strength=(which==0)? 1 : 0.2
if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}
</SCRIPT>
<img src=”imagename.jpg” mce_src=”imagename.jpg” style=”filter:alpha(opacity=20);-moz-opacity:0.2″ onMouseover=”makevisible_fn(this,0)” onMouseout=”makevisible_fn(this,1)”>

In above code,

style=”filter:alpha(opacity=20);-moz-opacity:0.2″ onMouseover=”makevisible_fn(this,0)” onMouseout=”makevisible_fn(this,1)”
will give the fade effect for the image. we can use the above code in all the images, that will give fade effect.

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.