[Javascript] Disabling the image submit button -- aspx
Guy Platt
guy at webbnet.com
Thu Nov 13 14:28:02 CST 2003
Chris Tifer penned the following on 11/13/2003 7:29 PM:
>First thing I would try is:
>
>alert(ProceedButton)
>
>on the line directly before your ProceedButton.disabled = true; statement
>
>See what that returns. If everything is ok, it should say [object] or
>something similar. It's possible that there's more than one of these buttons
>in the document so referencing getElementById would throw it off a little.
>
>
Thanks, I inserted the alert and get the message [object]. I was not
too worried about a duplicate ID as I am using CSS extensively and have
made sure that all ID's are unique.
I had left off the " ; " at the end of a sentence as an earlier post
noticed. However correcting this had no noticeable effect on the page.
I should add that the javascript is called from the aspx.cs file using
the following code:
ImageButton1.Attributes.Add("onclick", "javascript:submitonce();return
false;");
Here's the JS code (which isn't working).
<script LANGUAGE="JavaScript">
var submitted=false
function submitonce(theform)
{
if(submitted){return false}
var ProceedButton = document.getElementById('ImageButton1');
ProceedButton.disabled = true;
submitted=true;
return (true);
}
</script>
>Wouldn't that be ironic since that's the very thing being talked about in
>the other thread?
>
>Chris Tifer
>http://emailajoke.com
>
>
>
>
>
More information about the Javascript
mailing list