PDA

View Full Version : Problem in highlight image



sandra
08-28-2007, 02:05 PM
I have used bellow code to make my image highlight. but i want whenever i click on the image it be light till the end.

this code use in head tag:
<script>


function lightup(imageobject, opacity){
if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5)
imageobject.style.MozOpacity=opacity/100
else if (navigator.appName.indexOf("Microsoft")!=-1 && parseInt(navigator.appVersion)>=4)
imageobject.filters.alpha.opacity=opacity
}
</script>



and use this code in to the body:
<img border="0" src="images/thumbnails/1.jpg" width="30" height="30" style="filter:alpha(opacity=50); -moz-opacity:0.5"
onMouseover="lightup(this, 100)" onMouseout="lightup(this, 30)" onMouseClick="lightup(this, 100)">



thank you

jscheuer1
08-28-2007, 06:15 PM
Till the end of what? As soon as you move the mouse out, it will go back to 30.

Also, I don't think onmouseclick does anything, it's 'onclick'.

If you were to do something like so:


<img border="0" src="images/thumbnails/1.jpg" width="30" height="30" style="filter:alpha(opacity=50); -moz-opacity:0.5"
onmouseover="lightup(this, 100)" onmouseout="if(!this.lit){lightup(this, 30)}" onclick="this.lit=1;lightup(this, 100)">

It would probably be closer to what you are looking for, but assigning a script property to the image is poor form. But, since I'm not sure what you are really going for yet, first see how you like the effect.

You might also want to look at this:

http://home.comcast.net/~jscheuer1/side/files/fade_advanced_preset_write.htm

sandra
09-01-2007, 04:32 AM
Thanks alot john for your great answer. :) that's exactly that i need.
thanks :)