>From a form action, I am calling a javascript function with the form object. However, the this syntax doesn't seem to work. I have to pass document.forms instead.
>
>This doesn't work.
>
>
>...FORM NAME=Sujet ACTION=javascript:Go(this)
>
>< SCRIPT>
>function Go(toForm)
>{
> alert(toForm.MyField.value);
>}
>
>
>This works.
>
>
>...FORM NAME=Sujet ACTION=javascript:Go(document.forms.Sujet)
>
>< SCRIPT>
>function Go(toForm)
>{
> alert(toForm.MyField.value);
>}
>
>
>Why?
Michel;
I may be wrong but I presume you are referring to an HTML form. To me the syntax would be incorrect when attempting to use the word “this” to address the form. The form would not know what you were requesting, regardless of what scripting language was in use. “This” is a term from a methodology used to address an object such as in Visual FoxPro. The term “object” may be misunderstood when going from one programming environment to another. Using VFP, VB or HTML would require different syntax for addressing an object.
Tom