PDA

View Full Version : Input type=image. can it be disabled?


Steven_Smith
05-28-2003, 02:59 AM
I have a button that I wish to disable after it gets clicked once. Stop the double clicking.

The button is an input.

<input onfocus="this.blur();" type="image" name="go" src="images/credit_auth_01.gif" onmousedown="this.src='images/credit_auth_01-down.gif'" onmouseover="this.src='images/credit_auth_01-over.gif'" onmouseout="this.src='images/credit_auth_01.gif'">

When ever I try to access this button in the validate script for the form

document.formname.go.disabled=true It doesn't work. Can I disable a input type image?

Can I also change the src if the input like
document.formname.go.src='red_button.gif'?

I can't get this to work,

Steve

glenngv
05-28-2003, 03:04 AM
You can't disable an image submit button. What you can do is instead of disabling it, just put a return false so that succeeding statements are not executed.

To change the src, put an id to the input and do:

document.getElementById(id).src = 'another image';

Steven_Smith
05-28-2003, 03:28 AM
Thank you Glen.