Been following this thread and I just spotted something in Philip's code
snipplet that I have been wondering about.
Whenever you call an event function, I have always passed the name of the
form as 'this.form' Philip, you just called it with "this" Why does either
way work?? Also, in the function, you execute the submit with
"document.form1.submit" Could you have also done "object.submit()"?? I
have had a tough time getting used to the notation surrounding objects and
it looks like you can almost do whatever you want!!
Thanks for the onKeyUp event hint, too. This has provided me a way out of a
similar problem, too.
Jerry
----- Original Message -----
From: "Philip smith" <rooroo3@h...>
To: "javascript" <javascript@p...>
Sent: Friday, September 13, 2002 3:34 PM
Subject: [javascript] Re: automatically submit form when value entered in
input box
> Hi All
>
> yes just been having a tinker myself and come up with the following and
> found the same problem with onKeyPress and onKeyDown - oKeyUp seems to
> work ok
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML>
> <HEAD>
> <TITLE></TITLE>
> <script language="JavaScript">
>
> function checkDigits(objct) {
>
> if (objct.value.length == 6) {
> document.form1.submit();
> }
> }
>
> </script>
>
> </HEAD>
>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000"
> ALINK="#FF00FF" BACKGROUND="?">
>
> <form name="form1" action="validate.cgi" method="post">
> Please enter your six digit number: <input type="text" name="txt2"
> onKeyUp="checkDigits(this)">
> </form>
> </BODY>
> </HTML>
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
>