var inputs = document.getElementsByTagName("input");for(i=inputs.length-1;i>0;i--)
if( inputs[i].type == "text" ) break;
alert(inputs[i].value);