aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes how to change image after a click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to change image after a click" Watch "how to change image after a click" New topic
Author

how to change image after a click

preethi venkatarangan
Greenhorn

Joined: Jan 21, 2007
Posts: 27
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

Joined: Jan 10, 2002
Posts: 61437
    
  67

Change the src attribute of the image.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
Hint: Use <div> tags to put two sections with diff images etc. Use javascript to display the div inline ot hide it.


Amit Tank
Linked In
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

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

Joined: Sep 06, 2003
Posts: 259
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 ]

http://www.skillassert.com


 
 
subject: how to change image after a click