473,405 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Input Type Image and disabled

Hi all,

Does IE support disabled for the Image type in inputs? This small
example doesn't seem to work when the type is Image, but perfectly fine
when the type is submit.

Best Regards

<html>
<head>
<title>Lala</title>
</head>
<body>
<script>
<!--
function disable()
{
var button = document.getElementById("submit");
button.disabled = true;
button.style.color = "red";
return false;
}
-->
</script>
<form action="world.html" onsubmit="return disable()">
<input type="image" id="submit" src="Hello" Value="submit
"Alt="Submit">
</form>
</body>
</html>

Jun 20 '06 #1
3 12478
pe**********@yahoo.dk wrote:
Does IE support disabled for the Image type in inputs? This small
example doesn't seem to work when the type is Image, but perfectly fine
when the type is submit.
[snip code]


It appears to work (WinXP IE 6.0.29), but the disable-command is not
directly "visible" for the user. The image is just displayed whether
it's enabled or not. It should work for all INPUT-elements (at least in
HTML4.0+) regardless of the TYPE-argument:

http://www.w3.org/TR/html4/interact/forms.html#h-17.12

If you would decide to use the code, maybe you could swap your image to
another one that is more in "disabled-style" when the element is
actually disabled.

Hope this helps,

--
Bart

Jun 20 '06 #2
Bart Van der Donck wrote:
It appears to work (WinXP IE 6.0.29), but the disable-command is not
directly "visible" for the user.


You're right. It actually works, although it doesn't seem so for the
user. if I put in this conditional

....
if(button.disabled == true)
alert("Error");
button.disabled = true;
....

then the alert box never displays. But then there is one thing that
puzzles me: When I use this snippet in an other system I still recieve
double form submissions when testing...

Jun 21 '06 #3
pe**********@yahoo.dk wrote:
You're right. It actually works, although it doesn't seem so for the
user. if I put in this conditional

if(button.disabled == true)
alert("Error");
button.disabled = true;

then the alert box never displays.
That obviously depends on where you put it in your code. It should work
if you put it just before:

button.style.color = "red";

Your 'disable()'-function can be executed only once anyhow - after it's
done, the submit element is left disabled, so you can't execute the
'disable()'-function again.
But then there is one thing that
puzzles me: When I use this snippet in an other system I still recieve
double form submissions when testing...


Well, your code actually prevents form submissions.
You might invoke a processing script twice if you doubleclick on a
submit element. The rule is "one click = one submit".

--
Bart

Jun 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mark | last post by:
Hi, I create a button in the form in the asp page like is: <input type="image" src="button.gif" name="detail" border=0 value="100234"> How can I get this value from another page? I try sdetail...
4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
1
by: Wayne | last post by:
Please help... For some odd reason onclick is not working with and <input type="image"> but works fine on an <input type="button">.... This does not work: <input TYPE="image" src="go.gif"...
2
by: Kimmo R. M. Hovi | last post by:
Currently I have defined: -- clip clip -- <form method="post" action="xx" enctype="application/x-www-form-urlencoded"> <input type="image" name="Function 1" src="image1.gif" border="0"...
1
by: Brian Genisio | last post by:
Hi all, I noticed that the image input type does not show up in the elements array (IE 6.0). <FORM name=myForm> <INPUT name=rads id=check1 type=radio value=val1> <INPUT name=rads id=check2...
2
by: jon | last post by:
Hi This might be an easy one to answer but I have a web form in an ASP.NET 1.1 application with a hand-rolled HTML image button as follows which opens a help guide in a new window: <input...
3
by: jackiepatti | last post by:
QUESTION: I have a web page containing a form that contains an image instead of a submit button, e.g. <form name='myform' action='get' method='otherpage.asp'> <input type='image'...
2
by: wolfing1 | last post by:
So far I've been using instructions like 'if request.form("var.x") <> "" then ...' but then I found that if images are disabled (or not found) and I click on the alt text, then Firefox (or was it...
8
by: John | last post by:
Hi Pasrt of HTML - <div class='button'><input type='image' src='/images/check1.jpg'></input></div> Part of CSS - ..button {background-image: url(/images/check1.jpg); background-repeat:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.