does <img tag has disable property
hi all,
i am using an image as a button. so i want to disable it on some actions.
so i used
document.getElementById("imagName").disabled = true;
but it seems that this property is not working for
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
disabled only works on form elements.
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
but this image also in the form..
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
But it is not a form element. A form element is something like and .
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
It might be in the specs as being allowed but obviously browsers don't support it.
stymiee
He's No Good To Me Dead
3,360 posts since May 2006
Reputation Points: 161
Solved Threads: 38
If you use:
<input type="image" src="[href to image]"/>
You should be able to disable it. That's a valid input type; it should be supported widely.
Alterantively; try:
<button><img src="[href to image]"/></button>
You might have to restyle the button to stop it being drawn as an actual button... but the button will have a disabled property; and disabling the button will stop the image being clicked/prevent the button from being functional.
See: http://www.w3.org/TR/html4/interact/forms.html#h-17.4
MattEvans
Veteran Poster
1,386 posts since Jul 2006
Reputation Points: 522
Solved Threads: 64
![[href to image]](%5Bhref%20to%20image%5D)
this is the way i am useing the image as a button.
is this possible to disable.....?
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
ya. i have already used the id property to access it, but still it is not working. i am using the Mozilla browser. so the way to access the image is as follow.
document.getElementById("add").disabled = true;
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
Dude, you have the answer above already...the onClick parameter is ALWAYS going to run when clicked... this is NOT form input.... The input tag with type="image" is the CORRECT way to use an image as a button... if you don't do it correctly even when people tell you, then there is little we can do...
Now to do it your way, don't use disable, but hide the button all togther then it isn't being enabled... if they can't see it they can't click it, so your onClick won't be an issue...
OK, but I highly recomend using the proper method of input tag with type="image" parameter set.
rgtaylor
Junior Poster in Training
88 posts since Mar 2007
Reputation Points: 10
Solved Threads: 2
![[href to image]](%5Bhref%20to%20image%5D)
this is the way i am useing the image as a button.
is this possible to disable.....?
I don't think disabled works on an as you have it. Why not just use javascript to check if you've disabled an image?
eg:
[HTML]onclick="if(!this.disabled)sendAdd();"[/HTML]
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101