Form.target : Form Object « Form « JavaScript Tutorial






The target property represents the target window or frame in which the form results will be displayed.

This can also reflect the TARGET attribute of the HTML
tag.

Valid target attributes are: _blank, _parent, _self, and _top.

<html>
    <head>
    <title> Using the target property of the Form object</title>
    </head>
    <body>
    <script language="JavaScript">
    <!--
    function show(){
        var tar = document.form1.target;
        if(tar == "_self"){
          alert("this window");
        } else{
          alert("The target has not been specifically specified");
        }
    }
    -->
    </script>
    <form name="form1" action="post" target="_self">
    <br><br><br>
    <input type="button" value="submit" onClick='show()'>
    </form>
    </body>
    </html>








10.2.Form Object
10.2.1.Form
10.2.2.Using the Forms Array
10.2.3.Form.action
10.2.4.Form.elements
10.2.5.Form.elements.length
10.2.6.form.encoding
10.2.7.Form.handleEvent()
10.2.8.Form.length
10.2.9.Form.method
10.2.10.Form.name
10.2.11.Form.onReset
10.2.12.Form.onSubmit
10.2.13.Form.reset()
10.2.14.Form.submit()
10.2.15.Form.target