Javascript examples for DOM:Document getElementsByName
Get first element by name
<html> <head> <title>Javascript YAML Generator</title> </head> <body> <form class="yamlform" action="index.html" method="post"> <input type="text" name="appname" value="Name"> <button type="submit" onclick="writeAppName()">Submit</button> </form> <script type="text/javascript"> function writeAppName() {/* ww w. j a v a 2 s . c o m*/ var appname = document.getElementsByName("appname")[0].value document.write(appname) } </script> </body> </html>