David Dorward wrote:
Alexander Ross wrote:
I know that <a href="javascrip t:document.form name.submit();" > works
For some definitions of "work" - http://tom.me.uk/scripting/submit.asp
for
this, but can you use a hyperlink to submit a form WITHOUT assigning the
form tags name attribute a value. The site I am currently working on is
supposed to be HTML 4 (w3c) complient, but according to the HTML validator
the name attribute has been depreciated and should no longer be used.
You can access it via the id attribute,
document.getEle mentById('id_of _form').submit( ) - but removing the
dependancy on JavaScript would be the better option (see the above URL).
The default document object in most browsers contain a list of form objects on
the page as a 0-indexed array. Using document.getEle mentById() is unnecessary.
<a href="#" onclick="docume nt.forms[0].submit();retur n false;">Submit</a> will
work just fine.
Although I agree, remove the dependancy on the link entirely and use a normal
<input type="submit" ...> with CSS to make it look like a link. Sure, in older
browsers it'll be a big ugly button, but in newer browsers it'll look like a
link, and in all browsers it should submit the form, regardless of JavaScript
support.
--
| Grant Wagner <gw*****@agrico reunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html