Chris said:
Or:
<html>
<body>
<form id="MyForm" ACTION="
http://example.microsoft.com/sample.asp"
METHOD="POST">
<input type="submit" value="Press Me"
onclick="this.disabled=true;document.all.MyForm.submit();">
</input>
<form>
</body>
</html>
Regards,
Chris.
It's not properly formed HTML (there is no closing </input> tag and it should
be </form>, not <form>), but I'll assume those were typos (although I really
hope you don't write forms with opening and closing <input></input> tag sets).
As for the JavaScript on the page, well, in Mozilla Firebird (and other Gecko
based browsers), it generates the following error and fails to prevent a
second click on the button: Error: document.all has no properties
In Netscape 4.78 it generates the following error and fails to prevent a
second click on the button: document.all has no properties
It also fails to provide any sort of feedback mechanism to the user as to
*why* the button is no longer working (although that isn't as important as the
next point) and it will not submit the form at all if client-side JavaScript
is disabled.
So, before you unceremoniously ...snip... a working solution and replace it
with your own, perhaps you should ensure that your solution works as well in
as many browsers, does as much, and provides the desired functionality even if
the user chooses to disable client-side JavaScript.
There is more to JavaScript authoring then having the script work in one, or
even many, browsers. Part of being a good JavaScript programmer is ensuring
that whatever you are doing degrades gracefully and provides as much support
for as many people as possible. Even in an Intranet environment, this should
be the goal, because although your company runs Internet Explorer today, they
may not always run it, and having a solution that can be ported to other
browsers more readily will, ultimately, make your job easier.
Besides, providing the sort of "solution" you just provided means you've just
trained another JavaScript author to be sloppy, careless and care little for
the portion of their audience not using the tools you expect them to be using
(Internet Explorer with client-side JavaScript enabled).
My guess is it was getting lonely in the Sloppy, Careless and Care Little Club
and you wanted some new members.
--
| Grant Wagner <
[email protected]>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-developer/upgrade_2.html