The HTML entity parameter onclick
takes a string of Javascript that it will run when the node is clicked. href="javascript: (js code here)"
does pretty much the same thing. Right now it will eval return login();
which is a call to the Javascript function in the global scope named login
.
You should find the login() function and read its source to see what it does. You can either modify login() to perform your form submission, or swap out the event handler to call your own function.
You don't want NodeJS (which is javascript for server-side programming), or PhantomJS (which is a web integration testing tool with a Javascript interface). Neither of them apply to this problem domain. If you want a tool to make event handler binding more convenient, try jQuery. It provides DOM manipulation tools and a widely-used Ajax library.
see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit or http://api.jquery.com/submit/ for details on how to submit a form in your event handler function.