[Javascript] Disabling the image submit button -- aspx
David T. Lovering
dlovering at gazos.com
Thu Nov 13 17:23:46 CST 2003
Hmmm... maybe something like this would work better --
<script LANGUAGE="JavaScript">
> var submitted = 'false';
> function submitonce(theform)
> {
> if(submitted == 'true'){
return false;
} else {
> var ProceedButton = document.getElementById('ImageButton1');
> eval("ProceedButton.disabled = 'true'");
> submitted = 'true';
> return true;
}
> }
> </script>
I haven't tested it with any rigor, but this looks better and conforms somewhat to the
syntax issues etc.
-- Dave Lovering
Guy Platt wrote:
>
> 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
> >
> >
> >
> >
> >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list