RSS Forums RSS
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 7102 | Replies: 12
Reply
Join Date: Sep 2006
Posts: 65
Reputation: rpjanaka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Question does <img tag has disable property

  #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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

  #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  
Join Date: Sep 2006
Posts: 65
Reputation: rpjanaka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

  #3  
Feb 28th, 2007
but this image also in the form..
Reply With Quote  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

  #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  
Join Date: Sep 2006
Posts: 65
Reputation: rpjanaka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

  #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  
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Rep Power: 5
Solved Threads: 34
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: does <img tag has disable property

  #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  
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 48
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

Re: does <img tag has disable property

  #7  
Mar 1st, 2007
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
Plato forgot the nullahedron..
Reply With Quote  
Join Date: Sep 2006
Posts: 65
Reputation: rpjanaka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

  #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  
Join Date: Oct 2006
Location: somewhere in West-Africa
Posts: 202
Reputation: jamello is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 6
jamello's Avatar
jamello jamello is offline Offline
Posting Whiz in Training

Re: does <img tag has disable property

  #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  
Join Date: Sep 2006
Posts: 65
Reputation: rpjanaka is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rpjanaka rpjanaka is offline Offline
Junior Poster in Training

Re: does <img tag has disable property

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:46 pm.
Newsletter Archive - Sitemap - Privacy Statement - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC