[thelist] Calling onSubmit from within a script

Gerd Baumann gb at inetwire.com
Tue Mar 20 14:23:15 CST 2001


> Jeff Howden wrote:

> i would recommend that you call the event from a script block instead of
> trying to add it as an attribute of the <body> tag.  there are a number of
> ways to do this:
>
> <script language="JavaScript" type="text/javascript">
> <!--
>   function onLoad()
>   {
>     // do your onload stuff here
>   }
>
>   window.onload = onLoad;
> // -->
> </script>

Thanks Jeff,
from a fan with limited JS knowledge.  Following your recommendations,
I was wondering if I could possibly call an onSubmit event from within a
script, too. I tried this, but without luck:

function noInput() {
if (document.f.pw.value.length > 0)
 return true;
else {
 alert('Bitte benutzen Sie die Tastatur zur Eingabe Ihres Passworts.');
 return false;
 }
}

document.f.pw.onSubmit = noInput;

What is my mistake?

TIA,

Gerd





More information about the thelist mailing list