Simple HTML part for creating a text field and button:
<input id="name" type="text"> <button onclick="go()">Go</button>
And a simple script to go with it, which is called when the button is clicked:
function go() { var text = document.getElementById("name").value; alert("The user typed '" + text + "'"); }
Working demo: http://jsfiddle.net/jfriend00/V74vV/
In short, you put data entry fields on your page. Then you connect the event handler to some user event (for example, clicking a button) and in this code you extract the value from the data entry field and do whatever you want with it.
If you want to read about all types of input tags, read here .
You will probably also want to read document.getElementById("xxx") , which allows you to find the elements on your page to which you have assigned an identifier, and then extract properties from them.
source share