<!DOCTYPE html>
<
html
>
<
head
>
<
title
>DOM Form target Property</
title
>
<
style
>
h1 {
color: green;
}
body {
text-align: center;
}
</
style
>
</
head
>
<
body
>
<
h1
>GeeksforGeeks</
h1
>
<
h2
>DOM Form target Property</
h2
>
<
form
action
=
"#"
id
=
"GFG"
target
=
"_self"
>
First name:
<
input
type
=
"text"
name
=
"fname"
>
<
br
> Last name:
<
input
type
=
"text"
name
=
"lname"
>
<
br
> Address:
<
input
type
=
"text"
name
=
"Address"
>
<
br
>
<
input
type
=
"submit"
value
=
"Submit"
>
</
form
>
<
BR
>
<
b
><
p
>Click on Try it Button to set the
value of the target attribute.</
p
>
<
button
onclick
=
"Geeks()"
>Try it</
button
>
<
p
id
=
"sudo"
style
=
"color:green;fonnt-size:20px;"
>
</
p
>
<
script
>
function Geeks() {
// Set _blank property.
var x = document.getElementById(
"GFG").target = "_blank";
document.getElementById("sudo").innerHTML =
"The value of the target attribute was changed to"
+ x;
}
</
script
>
</
body
>
</
html
>