Results 1 to 3 of 3

Thread: Problem in highlight image

  1. #1
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem in highlight image

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    <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/s...eset_write.htm
    Last edited by jscheuer1; 08-28-2007 at 08:49 PM. Reason: Add Info
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2007
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thank you

    Thanks alot john for your great answer. that's exactly that i need.
    thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •