Javascript examples for DOM HTML Element:Button
Button formTarget Property - Change the value of the formtarget attribute of a button:
<!DOCTYPE html> <html> <body> <form action="#" method="get"> First name: <input type="text" name="fname" value="Mary"><br> Last name: <input type="text" name="lname" value="Bond"><br> <button id="myBtn" type="submit" formtarget="_blank">Submit</button> </form>//from w w w . ja v a 2 s .c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myBtn").formTarget = "_self"; document.getElementById("demo").innerHTML = "The value of the formtarget attribute was changed from '_blank' to '_self'."; } </script> </body> </html>