This works fine for me

HTML Code:
<script language="javascript" type="text/javascript" >
<!--
function my() 
{
	var var1;
	var1=document.getElementsByName("name_txt");
	document.write(var1.text);
}
-->
</script>      
<form id="form1" runat="server">
	<input id="Text1" type="text" name="name_txt" value="1234567890"/>
	<input id="Button1" type="button" value="button" onclick="my()"/>
</form>