action attribute | action property

all
alt
ch
dir
id
min
rel
top
url
URL
urn
Expand Minimize
This topic has not yet been rated - Rate this topic

Sets or retrieves the URL to which the form content is sent for processing.

HTML 4.01 Specification, Section 17.3

Syntax

HTML<element action="p" ... >
JavaScript

p = object.action

Property values

Type: String

the URL to use. If a relative path is specified, the base URL of the document is assumed.

Standards information

Remarks

The value of the action attribute depends on the context of the reference to the attribute. When read as a Document Object Model (DOM) attribute, action returns an absolute URL. The value specified by the page author is returned when action is read as a content attribute.

Examples

This example uses the action attribute to post a form to a specified URL.


<html>
   <form action="http://example.microsoft.com/sample.asp" 
      method="post">
      Enter your name: <input name="FName"></br>
      Favorite Ice Cream Flavor:
      <select name="Flavor">
         <option value="Chocolate">Chocolate
         <option value="Strawberry">Strawberry
         <option value="Vanilla" SELECTED>Vanilla
      </select>
      <p><input type=submit></p>
   </form>
</html>

This example uses the action attribute to specify a URL for the mailto protocol.


<form action="mailto:sales@widgets.com" method=GET>
  <input name=subject type=hidden 
     value="Widget%20Product%20Information%20Request">
  Enter your full mailing address<BR>
  <textarea name=body cols=40></textarea>
  <input type=submit value="Send Request"
</form>

See also

form

 

 

Build date: 11/28/2012

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.