[Javascript] Generic submit
Hassan Schroeder
hassan at webtuitive.com
Fri Jan 7 16:36:59 CST 2005
Alan Gardner wrote:
> I thought it looked good, but my javascript console says "Error:
> this.form has no properties". I've checked and the link is inside the
> form tag. Suggestions?
This (pun semi-intended) won't work -- the "this" refers to the
anchor tag that contains the onclick.
>> <a href="#" onclick="document.forms[this.form.id].submit();">
The only way I can imagine to genericize this so you don't need to
know the form's id or position in the forms array is to invoke a
function that walks back up the XML tree to find the parent element
that's a FORM, e.g. ( el.nodeType == 1 && el.nodeName == "FORM" ).
HTH!
--
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com
dream. code.
More information about the Javascript
mailing list