Let's say you have an entry on your page with an id input1, for example:
<input type="text" id="input1" />
First you need to get the item, and if you know Id, you can use document.getElementById('input1'). Then just call .valueto get the value of the input field:
var value = document.getElementById('input1').value;
Update
, id . , document.getElementsByName, :
var value = document.getElementsByName('txt')[0].value;