File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to change image after a click

 
preethi venkatarangan
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a link which is an image which when clicked opens a new window.
I have the link disabled in order to avoid multiple clicks.now my question is
how do i change the image for example

By doing this im able to disable the link.So the user cannot click again
But how do i replace the on.gif with off.gif in addition to disabling the link
In short after i click the on image link once I want the link to b disabled (which im able to by 1 and 2)& also i
want the image to change to off.gif.

Please provide me with any example or for the above example.


Thanks
Preethi
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Change the src attribute of the image.
 
Amit M Tank
Ranch Hand
Posts: 257
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: Use <div> tags to put two sections with diff images etc. Use javascript to display the div inline ot hide it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amit M Tank:
Hint: Use <div> tags to put two sections with diff images etc. Use javascript to display the div inline ot hide it.

Isn't that a bit heavy-handed when it's much easier to just set the src of the image?
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When changing the src of the image, the download time [from server to browser] comes into picture [ofcourse for the first time or depending on the caching policy set in the browser]. Here i have assumed the image is of considerable size [say more than 20KB and the link speed of the client machine having the browser is approx 256 kbps].

Also when we change src attribute of the image we should also change the width and height attribute of the new image [if new image is not of the same height and width as the previous image displayed else the image will look stretched or shrunken.
[ May 30, 2008: Message edited by: karthi keyan ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic