Javascript examples for DOM HTML Element:Input Submit
Input Submit formTarget Property - Change the value of the formtarget attribute of a submit 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> <input type="submit" id="mySubmit" value="Submit" formtarget="_blank"> </form>//from www .ja v a 2 s . com <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("mySubmit").formTarget = "_self"; document.getElementById("demo").innerHTML = "The value of the formtarget attribute was changed from '_blank' to '_self'."; } </script> </body> </html>