HOWTO: Submitting a Form From an Anchor (<A HREF=...>). (166210)



The information in this article applies to:

  • Microsoft JScript 1.0
  • Microsoft JScript 3.0
  • Microsoft JScript 5.0

This article was previously published under Q166210

SUMMARY

This article describes how a form can be submitted to a server through the use of an anchor. It uses the little-known ability of JScript that allows you to run a script from an anchor without using events.

MORE INFORMATION

There are two simple steps to submitting a form from an anchor:
  1. Be sure the form has values for the NAME, ACTION, and METHOD properties. The NAME and ACTION properties are the only required ones, but it is a good idea to supply the METHOD also, for example:
          <FORM NAME=Form1 ACTION="http://myServerURL/MyPage.asp" METHOD=POST>
          </FORM>
    						
  2. Call a one-line script from an anchor. In the script, call the submit method of the form, for example:
    <A HREF="JAVASCRIPT:Form1.submit()"> Something </A>
    						
    NOTE: JavaScript is case-sensitive, so submit must be spelled all lowercase.

REFERENCES

For additional information on JScript and forms visit the MSDN Online Web Workshop:

Modification Type:MajorLast Reviewed:11/17/2003
Keywords:kbhowto KB166210