[Javascript] submitting a form using anchor tags

Ivanner Mora ivanner at hotmail.com
Tue May 8 13:26:21 CDT 2001


> <a
>
href="javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,
> this.form)">Vouchers</a>

ERROR!!!
Try this:

<a href="javascript:addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,
this.form)">Vouchers</a>


Ivanner Mora ICQ# 45326279
----- Original Message -----
From: "ryan tornberg" <rtornberg at yahoo.com>
To: <javascript at LaTech.edu>
Sent: Tuesday, May 08, 2001 12:04 PM
Subject: [Javascript] submitting a form using anchor tags


> I have multiple buttons on a form, so I declare them
> in HTML as type=button and name them as the form
> action.  I then send the button name and form name to
> a js function to submit the form.
>
> in HTML
>
> <input type=button name=myURL
> onClick=submitMe(this.name, this.form)>
>
> in javascript
>
> function submitMe(action, form)
> {
>   form.action=action;
>   form.submit();
> }
>
> This works fine when it's attached to a button.  The
> action gets sent as a string and the form gets sent as
> an object.  The problem is that when I try to use this
> exact same idea in an anchor tag, the form is
> undefined.  Do you know how I can get around this?
>
> The following will get to the function, but the form
> is undefined.
> <a
>
href="javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,
> this.form)">Vouchers</a>
>
> The following won't even get to the function because
> of a syntax error.  I'm trying to hard code the form
> by using the document object.
> <a
>
href="javascript:onClick=addVoucher(Default.ASP?WCI=VoucherDisplay&WCE=Add,
> document.frmDisplay)">Vouchers</a>
>
> Any ideas?
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list