Try this

var1=document.getElementsByName("name_txt");