Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 7102 | Replies: 12
![]() |
•
•
Join Date: Sep 2006
Posts: 65
Reputation:
Rep Power: 0
Solved Threads: 0
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
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
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Sep 2006
Posts: 65
Reputation:
Rep Power: 0
Solved Threads: 0
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...?
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...?
•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
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!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
•
•
Join Date: Jul 2006
Location: Deptford, London
Posts: 971
Reputation:
Rep Power: 5
Solved Threads: 48
If you use:
You should be able to disable it. That's a valid input type; it should be supported widely.
Alterantively; try:
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
<input type="image" src="[href to image]"/>
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..
•
•
Join Date: Oct 2006
Location: somewhere in West-Africa
Posts: 202
Reputation:
Rep Power: 3
Solved Threads: 6
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>
that is
<img src="[href to image]" id="add" name="add" onclick="sendAdd();">
<script lang=javascript>
document.all.add.disabled = true;
</script>
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode