How can I create automatic login system on javascript?

I have less knowledge on JavaScript.
I wanted to automate my local intranet site login.
We usually enter our username and password to login.
I need to automate this process.
The page contains various frames etc… How can I map the username and password that I have with the input box in the page and enter submit button dynamically?
Please help me out…it would be great if there is a sample code or tutorial for this.

Do you have a link to a github repository of the code you currently have?

Where are you getting the username and password from? Is the user typing it in somewhere or are you getting it from somewhere else?