[thelist] Simple JS question.

jsWalter jsWalter at torres.ws
Tue Nov 30 10:18:04 CST 2004


> Hola list!
>
>
> Will this bit of JavaScript set the "when_date" field in the "TUWTCY"
> form to null when the page is loaded?
>
> <SCRIPT language="JavaScript">
> document.TUWTCY.when_date.value = "" ; </SCRIPT>

1) Have you tried it? If so, what did it do?
   If not, why not?

2) yes, it will insert a NULL in the Form Object 'TUWTCY'

3) But, only if this piece of code is:
   a) at the end of the document
   b) ran from the BODY ONLOAD event
   c) ran as an action sometime later
   Otherwise you'll get an "Object Not Found' error
   since the FOrm Object has not been created on the page yet.

4) I wouldn't use this syntax. It is not X-Browser

   document.getElementById ('TUWTCY').value = '';

   ofcourse, assuming you've given the Form Object an ID of
   'TUWTCY' and not just the NAME.

But then again, this piece of code is not needed when the page first
loads. You must be using this for another reason, at some point in your
process.

Hope this helps.

Walter



More information about the thelist mailing list