X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

Form target Property

Form Object Reference Form Object

Example

Change where to display the response that is received after submitting a form (open the response in a new window instead of the same frame as it was clicked):

document.getElementById("myForm").target="_blank";

Try it yourself »


Definition and Usage

The target property sets or returns the value of the target attribute in a form.

The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The target property is supported in all major browsers.


Syntax

Return the target property:

formObject.target

Set the target property:

formObject.target="_blank|_self|_parent|_top|framename"

Property Values

Value Description
_blank Opens in a new window
_self Opens in the same frame as it was clicked (default)
_parent Opens in the parent frameset
_top Opens in the full body of the window
framename Opens in a named frame

Technical Details

Return Value: A String, representing where to display the response that is received after submitting the form


More Examples

Example

Return the value of the target attribute in a form:

var x = document.getElementById("myForm").target;

The result of x will be:

_self

Try it yourself »


Related Pages

HTML reference: HTML <form> target attribute


Form Object Reference Form Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook