[Javascript] submitting a form using anchor tags
Filipiak, Bob (Contractor)
filipiab at atsc.army.mil
Tue May 8 13:13:33 CDT 2001
Please provide more code. What does the addVoucher() do? Also, AFAIK there
is no this.form for <a href=.....>
Bob Filipiak (Contractor)
MCP
-----Original Message-----
From: ryan tornberg [mailto:rtornberg at yahoo.com]
Sent: Tuesday, May 08, 2001 2:05 PM
To: javascript at LaTech.edu
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20010508/2dca41f8/attachment.htm>
More information about the Javascript
mailing list