Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gray out button at the end of images array

Status
Not open for further replies.

hunt00

Technical User
Mar 6, 2005
79
US
How could i gray out the Next button after finishing the last image by onclick.
 
To grey out theElement (a button):
[tt] theElement.disabled=true;[/tt]
 
For an image, can i use:
document.images['nextbutton'].disabled = true;
 
because it didnt work. Not sure if the syntax is different
 
It doesn't really make sense to set the image to disabled... I mean... an image is an image... not a form element. You can set the disabled property on form elements.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Thanks tsuji and Jeff. I will try other ways.
 
[tt]<!-- quick test - disabled attribute on some form elements -->
<html>
<head>
<script language="javascript">
function doit(obj) {
alert(obj.disabled);
obj.disabled=!obj.disabled;
}
function imgdisabledattr_toggle() {
alert(document.images["xyz"].src + "\n" + document.images["xyz"].disabled);
document.images["xyz"].disabled=!document.images["xyz"].disabled;
alert(document.images["xyz"].src + "\n" + document.images["xyz"].disabled);
}
</script>
</head>
<body>
<form>
<input type="button" value="some_button" onclick="doit(this)" />
<img src="abc.gif" name="xyz" alt="an_image" onclick="doit(this)" />
<input type="text" onclick="doit(this)" />
</form>
<button onclick="imgdisabledattr_toggle()">toggle the image disabled attribute</button>
</body>
</html>
[/tt]
img can well be a form element and capture server-side upon submit action. Once disabled, it is not "greyed"; it is disabled nonetheless.
 
img can well be a form element and capture server-side upon submit action
Sorry if I appear a bit dense about this... but I have no idea what you are on. The code you posted does not use an image as a form element. You are merely setting a custom property on the image which has an ID - the custom property has no other effect... and the image will never be sent as part of the form submission regardless of what you do with this property.

Please correct me if I am wrong... but I just don't see what you are saying and what you are doing as making any sense.

Cheers,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
I should make it an input element
[tt]<input type="image" src="abc.gif" name="abc" ...>[/tt]
as a base to make thing more acute and articulated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top