js getelementsbyname code example
Example 1: check the doc name in javascript
var path = window.location.pathname;
var page = path.split("/").pop();
console.log( page );
Example 2: select input by name javascript
var element = document.querySelector("form[name='second'] input[name='secondText']");