does <img tag has disable property

Reply

Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

does <img tag has disable property

 
0
  #1
Feb 27th, 2007
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 <img
because when i check it with text field by displying an alert

alert(document.getElementById("textField").disabled );

it will alert a boolean value. but when it checked with the image it will alert as "undefined"..

so i want to know that disable property is valid for <img

thanks..
janaka priyadarshana
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

 
0
  #2
Feb 27th, 2007
disabled only works on form elements.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

 
0
  #3
Feb 28th, 2007
but this image also in the form..
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

 
0
  #4
Feb 28th, 2007
But it is not a form element. A form element is something like <input> <select> and <textarea>.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

 
0
  #5
Feb 28th, 2007
but
http://www.java2s.com/Code/JavaScrip...sappliedto.htm

in the above page it is mentioned that dasabled property can be applied for <img

is that wrong...?
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

 
0
  #6
Mar 1st, 2007
It might be in the specs as being allowed but obviously browsers don't support it.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: does <img tag has disable property

 
0
  #7
Mar 1st, 2007
If you use:
HTML and CSS Syntax (Toggle Plain Text)
  1. <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:

HTML and CSS Syntax (Toggle Plain Text)
  1. <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
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

 
0
  #8
Mar 14th, 2007
<img src="[href to image]" name="add" onclick="sendAdd();">

this is the way i am useing the image as a button.
is this possible to disable.....?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 216
Reputation: jamello is an unknown quantity at this point 
Solved Threads: 6
jamello's Avatar
jamello jamello is offline Offline
Posting Whiz in Training

Re: does <img tag has disable property

 
0
  #9
Mar 14th, 2007
i believe you can. add id property and then try and disable. Pls get back to me.
that is

<img src="[href to image]" id="add" name="add" onclick="sendAdd();">

<script lang=javascript>
document.all.add.disabled = true;
</script>

Originally Posted by rpjanaka View Post
<img src="[href to image]" name="add" onclick="sendAdd();">

this is the way i am useing the image as a button.
is this possible to disable.....?
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 68
Reputation: rpjanaka is an unknown quantity at this point 
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

 
0
  #10
Mar 15th, 2007
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;
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC