[Javascript] IE onclick problem
tedd
tedd at sperling.com
Fri Apr 18 18:41:36 CDT 2008
At 7:50 PM +0100 4/18/08, David Dorward wrote:
>On 18 Apr 2008, at 18:48, tedd wrote:
>>> <script type="text/javascript">
>>> window.onload=function() {
>>> var form=document.getElementById('someform');
>>> if (form) form.onsubmit = checkMyForm;
>>> }
>>> </script>
>>
>> Howard:
>>
>> I spoke too soon -- take a look at this:
>>
>> http://webbytedd.com/ccc/test-onsubmit1/index.php
>
>
>You have:
> form.onsubmit = checkForm(form);
>
>So you are calling checkForm, with the the form as an argument, and
>assigning the return value to onsubmit.
>
>The return value is going to be false (since the form isn't filled in
>at load time), but it needs to be a function.
>
> form.onsubmit = function (f) {
> return function () {
> checkForm(f)
> };
> }(form);
>
>Here I generate an anonymous function with one argument, and call it
>with the form as the argument immediately. The return value (another
>anonymous function, which calls checkForm when it is run) is assigned
>to onsubmit.
That still did not seem to work as it should -- unless I screwed up
(most likely).
But, the code provided by Howard did work.
Thanks all.
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
More information about the Javascript
mailing list