Javascript examples for DOM HTML Element:Button
Button formMethod Property - returning the formMethod property:
<!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 type="submit">Submit</button> <button id="myBtn" type="submit" formmethod="post">Submit using POST</button> </form>// w w w . ja v a 2 s . c o m <button onclick="myFunction()">Return formmethod of the second button</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myBtn").formMethod; document.getElementById("demo").innerHTML = x; } </script> </body> </html>