[thelist] Having a Javascript "document.submit" Error

Diego Barcia webmaster at sci-web.com.ar
Wed Jan 29 19:30:01 CST 2003


>And the following code for the submit button (also using Youngpup's
>Soopa-Rollover JavaScript for the off/on rollovers):

><a href="javascript: document.paypal_moneymoxie.submit();"><img
>src="/img/button_regnow_off.gif" hsrc="/img/button_regnow_on.gif"
>width="75" height="15" border="0" /></a>

>There are four such forms on this page, and I've made sure
>that they form NAME and document.NAME.submit(); match in
>each one of them.

>These forms work when placed INDIVIDUALLY on a page, but
>not together.

You can add standard reset buttons (input type="submit") for each form, that
usually work as you press on them or press "Enter", submitting the active
form. You don't really need JavaScript to submit forms, except when you need
to avoid the form beeing submitted (checking forms fields, etc). If you have
a javascript error or javascript disabled, the forms won't work.

If you need to use JavaScript for any other reason, the problem is that you
must differentiate one form from the others (do the forms have different
names?). In this case the 'name' attributes should be used as 'id'
attributes. Something like this: <a href="javascript:"
onClick="document.forms['formName'].submit();">etc.

db







More information about the thelist mailing list