Results 1 to 5 of 5
  1. #1

    Image change on Click.

    How do I make it so that an image changed when click it and then it changes back when I click it again? I can't seem to find a script or anything.

  2. #2
    Join Date
    Aug 2006
    Location
    Los Angeles,CA
    Posts
    15
    Do you want client side script i.e Javascript/Ajax? In Javascript you need to call a function when an onclick event is fired. You need to use display: block or none to do the trick.

    Dexter Zafra

  3. #3
    Javasdcript. I understand onclick but i dont know who to get the picture to spwap or display properly.

  4. #4
    Join Date
    Aug 2006
    Location
    Los Angeles,CA
    Posts
    15
    Neonian,

    I would recommend reading some JavaScript books or online tutorials. I don't think you are in the right forum to ask this type of question regarding advanced JScript. I'll bet you if you post this question in sitepoint.com or developers.com forum you'll get many responses with example code.

    Dexter Zafra
    Want to learn ASP.NET?
    Check out my Free ASP.NET Application

  5. #5
    Join Date
    May 2006
    Posts
    77
    not tested but this should work
    Code:
    <img src="myimage.gif" onClick="this.src='newimage.gif'">
    
    onClick="if(this.src='myimage.gif')this.src='newimage.gif';else this.src='oldimage.gif'"

Posting Permissions

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