SV: [thelist] javascript - how to refer to (x)html elements

Marcus Andersson marcan at home.se
Thu Nov 13 01:17:12 CST 2003


>I can't seem to get working for some reason.
>It's as if the oForm isn't being "read" properly or something like
that.

>I've uploaded a page [1], where you can see the two variations. 'Task
1' on the page is the method you've just suggested, and 'Task 2' is the
currently working method using the forms array.

>If you have the time can you please take a look to see what's going on.

>[1] <http://www.greaterthani.com/05_programming/week5b.htm>

You currently have this code in your form:

        <form action="" method="get" onsubmit="taskOne(this.form)">
              <input type="text" name="myName" />
              <input type="button" name="submit" value="submit" />
        </form>

If you want your form to trigger onsubmit you need to change your input
type="button" to input type="submit". You would also like to change you
onsubmit to refer to this instead of this.form

It will then look like this:

        <form action="" method="get" onsubmit="taskOne(this)">
              <input type="text" name="myName" />
              <input type="submit" name="submit" value="submit" />
        </form>

/Marcus



More information about the thelist mailing list