How i can change image in ListView on click?

How to change image with mouse click?

  • using javascripts or DHTML can we change image with a mouse click? Actually i want to give some graphical effects to my images.

  • Answer:

    Try this code and replace your images name with "bulbon.gif" and "bulboff.gif" <html> <head> <script type="text/javascript"> cc=0; function changeimage() { if (cc==0) { cc=1; document.getElementById('myimage').src="… } else { cc=0; document.getElementById('myimage').src="… } } </script> </head> <body> <img id="myimage" onclick="changeimage()" border="0" src="bulboff.gif" width="100" height="180" /> <p>Click to turn on/off the light</p> </body> </html>

x2 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Lots of examples and codes at following sites: http://www.dynamicdrive.com/dynamicindex15/index.html http://www.stunicholls.com/gallery/index.html Mouseovers are a lot better to change images as viewer doesn't have to click. Example: Mouseover - CSS <style type="text/css"> .banner { background: url('Image1.png') no-repeat center scroll; width: 128px; height: 131px; padding-top: 10%; } .banner:hover { background: url('image2.png') no-repeat center scroll; width: 128px; height: 131px; } a { color: #006800; font-weight: 900; font-size: 1em; } </style> <div class="banner"><a href="#" title="Mouseover Me">Mouseover Me</a></div> HTHs, Ron

Shadow Knows

Graphical effects - you mean to enlarge it? onclick="this.src='yourimage.jpg';this… You can specify a different source, it would also change the image, this is the easiest way.

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.